Jetson Orin Nano Devkit + Torchvision

I’m intending to use Jetson Orin Nano devkit with Ultralytics and Python. Torchvision can’t see Cuda device while Jetpack 6.2 with Cuda is installed (Tried older Jetpack versions aw). I started digging internets and this forum and figured out that instead of ‘pip install torch…’ i have to download custom wheel from Nvidia / AI lab / …, for instance i’ve seen recomendation to

wget https://pypi.jetson-ai-lab.dev/jp6/cu126/+f/6ef/f643c0a7acda9/torch-2.7.0-cp310-cp310-linux_aarch64.whl#sha256=6eff643c0a7acda92734cc798338f733ff35c7df1a4434576f5ff7c66fc97319 wget https://pypi.jetson-ai-lab.dev/jp6/cu126/+f/daa/bff3a07259968/torchvision-0.22.0-cp310-cp310-linux_aarch64.whl#sha256=daabff3a0725996886b92e4b5dd143f5750ef4b181b5c7d01371a9185e8f0402

However, i’m getting either “no route to host” or “file not found” when I’m trying to do so.

Please, instruct me about the right way to install and import Torch

*** Please note that this reply is generated by LLM automatically ***

I’d be happy to help you with installing and importing Torch on your Jetson Orin Nano devkit.

Background

The issue you’re facing is due to the fact that the standard PyTorch installation using pip doesn’t work on Jetson devices, as they require custom-built wheels that are compatible with the device’s architecture and CUDA version. NVIDIA provides these custom wheels through their AI Lab repository.

Solution

To install Torch on your Jetson Orin Nano devkit, you’ll need to download the custom wheels from the NVIDIA AI Lab repository. Here are the steps:

  1. Check your CUDA version: Before downloading the wheels, make sure you have the correct CUDA version installed on your Jetson device. You can check the CUDA version by running nvcc --version in your terminal.
  2. Download the custom wheels: Use the following commands to download the custom wheels for Torch and Torchvision:
wget https://pypi.jetson-ai-lab.dev/jp6/cu12/torch-1.12.0-cp310-cp310-linux_aarch64.whl
wget https://pypi.jetson-ai-lab.dev/jp6/cu12/torchvision-0.13.0-cp310-cp310-linux_aarch64.whl

Note that the URLs may vary depending on the CUDA version and PyTorch version you want to install. Make sure to check the NVIDIA AI Lab repository for the latest available wheels.
3. Install the wheels: Once you’ve downloaded the wheels, install them using pip:

pip3 install torch-1.12.0-cp310-cp310-linux_aarch64.whl
pip3 install torchvision-0.13.0-cp310-cp310-linux_aarch64.whl
  1. Verify the installation: After installation, verify that Torch is working correctly by running a simple Python script:
import torch
print(torch.__version__)
print(torch.cuda.is_available())

This should print the PyTorch version and indicate that CUDA is available.

Comparison with older Jetpack versions

If you’re using an older Jetpack version, you may need to use a different URL or wheel version. For example, if you’re using Jetpack 4.6, you may need to use the following URLs:

wget https://pypi.jetson-ai-lab.dev/jp46/cu10/torch-1.9.0-cp36-cp36-linux_aarch64.whl
wget https://pypi.jetson-ai-lab.dev/jp46/cu10/torchvision-0.10.0-cp36-cp36-linux_aarch64.whl

Make sure to check the NVIDIA AI Lab repository for the correct wheels and URLs for your specific Jetpack version.

Troubleshooting

If you encounter issues during installation, such as “no route to host” or “file not found” errors, try the following:

  • Check your internet connection and ensure that you can access the NVIDIA AI Lab repository.
  • Verify that you’re using the correct URLs and wheel versions for your Jetpack version and CUDA version.
  • Try using a different download method, such as curl or wget with the --retry option.

I hope this helps you install and import Torch on your Jetson Orin Nano devkit!

*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***

failed: No route to host. - every my attempt to get something from ai-lab :(

(.venv) v@ubuntu:~/F1R3S1GHT2$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Wed_Aug_14_10:14:07_PDT_2024
Cuda compilation tools, release 12.6, V12.6.68
Build cuda_12.6.r12.6/compiler.34714021_0

Hi,

Please try to use legacy torch wheels instead.

https://github.com/davidl-nv/torch/tree/main/torch-2.8

Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.