I have been trying to install torch and torchvision on Jetson NX Nano using a venv env. So far I have flashed Ubuntu 22.04, Release: 5.15.148-tegra into the Dev Kit by following a great video tutorial posted by JetsonHacks.
After installing an SDK manager, I now have JetPack v6.2 with the following configurations:
Python: 3.10.12
CUDA: 12.6.68
cuDNN: 9.3.0.75
TensorRT: 10.3.0.30
OpenCV: 4.5.4 w/o CUDA.
L4T: 36.4.3
I followed it up with this pytorch installation guide as it matches my configurations. I will briefly post what commands I ran to install cuSPARSELt, torch and torchvision:
$ wget https://developer.download.nvidia.com/compute/cusparselt/0.7.0/local_installers/cusparselt-local-tegra-repo-ubuntu2204-0.7.0_1.0-1_arm64.deb
$ sudo dpkg -i cusparselt-local-tegra-repo-ubuntu2204-0.7.0_1.0-1_arm64.deb
$ sudo cp /var/cusparselt-local-tegra-repo-ubuntu2204-0.7.0/cusparselt-*-keyring.gpg /usr/share/keyrings/
$ sudo apt-get update
$ sudo apt-get -y install libcusparselt0 libcusparselt-dev
$ pip3 install --no-cache https://developer.download.nvidia.com/compute/redist/jp/v61/pytorch/torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl
$ sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libopenblas-dev libavcodec-dev libavformat-dev libswscale-dev
$ git clone --branch release/0.20 https://github.com/pytorch/vision torchvision
$ cd torchvision
$ export BUILD_VERSION=0.20.0
$ python3 setup.py install --user # remove --user if installing in virtualenv
When I verified by import torchvision, I got an already mentioned error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/venvs/envpy310/lib/python3.10/site-packages/torchvision/__init__.py", line 10, in <module>
from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils # usort:skip
File "/home/user/venvs/envpy310/lib/python3.10/site-packages/torchvision/_meta_registrations.py", line 164, in <module>
def meta_nms(dets, scores, iou_threshold):
File "/home/user/venvs/envpy310/lib/python3.10/site-packages/torch/library.py", line 720, in register
use_lib._register_fake(op_name, func, _stacklevel=stacklevel + 1)
File "/home/user/venvs/envpy310/lib/python3.10/site-packages/torch/library.py", line 180, in _register_fake
handle = entry.fake_impl.register(func_to_register, source)
File "/home/user/venvs/envpy310/lib/python3.10/site-packages/torch/_library/fake_impl.py", line 31, in regi ster
if torch._C._dispatch_has_kernel_for_dispatch_key(self.qualname, "Meta"):
RuntimeError: operator torchvision::nms does not exist
The corresponding site and other searches recommend installing the pre-compiled binaries:
$ pip install http://jetson.webredirect.org/jp6/cu126/+f/5cf/9ed17e35cb752/torch-2.5.0-cp310-cp310-linux_aarch64.whl#sha256=5cf9ed17e35cb7523812aeda9e7d6353c437048c5a6df1dc6617650333049092
$ pip install http://jetson.webredirect.org/jp6/cu126/+f/5f9/67f920de3953f/torchvision-0.20.0-cp310-cp310-linux_aarch64.whl#sha256=5f967f920de3953f2a39d95154b1feffd5ccc06b4589e51540dc070021a9adb9
However, that didn’t help. I followed the steps as instructed, yet to no avail. I am only using venv instead virtualenv.
Could someone give a hand?