DEV Community

Cover image for Python 3.13 GPU on Jetson Nano with Headless Mac M3
제민욱
제민욱

Posted on • Edited on

Python 3.13 GPU on Jetson Nano with Headless Mac M3

I'll set up my Jetson Nano as a headless device, connecting it to my MacBook via USB-C to Ethernet. The Mac will be on Wi-Fi, sharing its internet with Jetson while I access it over SSH, ensuring Jetson operates without Wi-Fi.

1. Product

Image description

  • USB 3.1 c-type to RJ45

Image description

  • M3 Macbook

2. Setup

1. Physical Connection

  • Connect the Mac and Jetson using a USB-C to LAN adapter and an Ethernet cable.

Image description

2. Mac Configuration

  • System Preferences > Network > Ethernet(LAN):
    • Select "Configure Using DHCP" to automatically assign an IP (typically 192.168.2.1).
  • System Preferences > Sharing:
    • Enable "Internet Sharing".
    • Share from: Wi-Fi, To computers using: Ethernet(LAN).

3. Jetson Configuration

  • Install and enable SSH server:
$ sudo apt update
$ sudo apt install openssh-server
$ sudo systemctl enable ssh
$ sudo systemctl start ssh
Enter fullscreen mode Exit fullscreen mode
  • Disable Wi-Fi (use Mac connection only):
$ nmcli radio wifi off
Enter fullscreen mode Exit fullscreen mode
  • Set a static IP for the Ethernet interface:
$ sudo nmcli connection modify "Wired connection 1" ipv4.method manual ipv4.addresses "192168.2.2/24" ipv4.gateway "192.168.2.1" ipv4.dns "8.8.8.8"
$ sudo nmcli connection up "Wired connection 1"
Enter fullscreen mode Exit fullscreen mode

4. Verify Connection

  • SSH into Jetson from Mac:
$ ssh jetson@192.168.2.2
Enter fullscreen mode Exit fullscreen mode
  • Check internet connectivity from Jetson:
$ ping google.com
Enter fullscreen mode Exit fullscreen mode

4. Cuda12 & Pytorch2.*

$ sudo apt install -y python3.12
$ python3 --version

# cuda
$ sudo apt install -y ubuntu-drivers-common
$ sudo ubuntu-drivers autoinstall
$ sudo apt-get install -y cuda-toolkit-12-6

$ echo 'export PATH=/usr/local/cuda-12.6/bin:$PATH' >> ~/.bashrc
$ echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.6/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
$ source ~/.bashrc

$ nvidia-smi # check

# pytorch 2.x
$ python3.12 -m venv .venv
$ source .venv/bin/activate
$ pip install torch --index-url https://download.pytorch.org/whl/cu126
$ pip install torchvision torchaudio
$ python3 -c "import torch; print('PyTorch version:', torch.__version__); print('Device:', torch.device('cuda' if torch.has_cuda else 'cpu'))"
Enter fullscreen mode Exit fullscreen mode

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay