Pytorch for jetson nano orin does not work

I installed all the useful libraries and also CUDA (version 11.8.89), but when I install torch version: 2.0 .0+nv23.05 and torchvision version : 0.15.1
following the specific instructions for installing on jetson given by nvidia (PyTorch for Jetson) and trying to test everything (python3; >>import torch ; >>torch.cuda.is_available() = true) BUT (python3; >>import torchvision =>
gives the following error which I can’t fix:
Traceback (most recent call last):
File “”, line 1, in
File “/home/fenixtek/.local/lib/python3.8/site-packages/torchvision-0.15.1-py3.8-linux-aarch64.egg/torchvision/”, line 6, in
from torchvision import datasets, io, models, ops, transforms, utils
File “/home/fenixtek/.local/lib/python3.8/site-packages/torchvision-0.15.1-py3.8-linux-aarch64.egg/torchvision/datasets/”, line 1, in
from ._optical_flow import FlyingChairs, FlyingThings3D, HD1K, KittiFlow, Sintel
File “/home/fenixtek/.local/lib/python3.8/site-packages/torchvision-0.15.1-py3.8-linux-aarch64.egg/torchvision/datasets/”, line 12, in
from …io.image import _read_png_16
File “/home/fenixtek/.local/lib/python3.8/site-packages/torchvision-0.15.1-py3.8-linux-aarch64.egg/torchvision/io/”, line 8, in
from ._load_gpu_decoder import _HAS_GPU_VIDEO_DECODER
File “/home/fenixtek/.local/lib/python3.8/site-packages/torchvision-0.15.1-py3.8-linux-aarch64.egg/torchvision/io/”, line 1, in
from …extension import _load_library
File “/home/fenixtek/.local/lib/python3.8/site-packages/torchvision-0.15.1-py3.8-linux-aarch64.egg/torchvision/”, line 107, in
File “/home/fenixtek/.local/lib/python3.8/site-packages/torchvision-0.15.1-py3.8-linux-aarch64.egg/torchvision/”, line 80, in _check_cuda_version
raise RuntimeError(
RuntimeError: Detected that PyTorch and torchvision were compiled with different CUDA versions. PyTorch has CUDA Version=11.4 and torchvision has CUDA Version=11.8. Please reinstall the torchvision that matches your PyTorch install.

and I get the same error even if I try to run my py code containing my project based on yolo

if I clearly follow the guide given by pytorch (Start Locally | PyTorch) when I then test the result I have (python3; >>import torch ; >>torch.cuda.is_available() = false) and same doing “pip3 install torch” ; “pip3 install torch==2.0.0” ; “pip3 install torchvision” ; “pip3 install torchvision==0.15.1” ; etc etc

so I think that to install pytorch I have to follow the appropriate nvidia guide (as above: PyTorch for Jetson), but in any case that error comes out!
I don’t know if I need to modify some installation files or download other libraries, I’m desperate!
if I made a trivial mistake, forgive me, I’m still a beginner despite everything.
I hope someone can help me and I thank in advance anyone who can help me solve the problem!

(sorry, I forgot to tell you my Jetpack version : 5.1.1)

@stefanogarzonii you upgraded your version of CUDA to 11.8. Try compiling torchvision with CUDA 11.4 instead (which is what that PyTorch wheel was built with). You might be able to change your /usr/local/cuda symlink back to /usr/local/cuda-11.4

hi, thanks, but I have several environment paths that contain …/cuda ; do I have to remove them all and put only the one indicated by you?

I’m not sure, but you want to build torchvision with CUDA 11.4 version of nvcc. Or just run the l4t-pytorch container which already has PyTorch+torchvision pre-installed with GPU acceleration working:

I changed every PATH containing a reference to cuda with cuda-11.4 and now it works, Thanks a lot!

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