Error when importing torch in python on Jetson Orin Nano

I recently upgraded my Jetson Orin Nano to Jetpack 6.2. I later installed pytorch using the instructions here:

I used the v2.2.0 wheel to install pytorch.

When I try to import torch in my python program, this is the error I get:
import torch
File “/home/orin/.local/lib/python3.10/site-packages/torch/init.py”, line 236, in
from torch._C import * # noqa: F403
ImportError: libcudnn.so.8: cannot open shared object file: No such file or directory

This the output of jtop that shows I have cuda and cuDNN both installed.

Here is the output of nvcc --version:
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

Can I please get help to resolve this issue? Thank you!

Hi

Please try install torch 2.5

$ wget http://jetson.webredirect.org/jp6/cu126/+f/5cf/9ed17e35cb752/torch-2.5.0-cp310-cp310-linux_aarch64.whl#sha256=5cf9ed17e35cb7523812aeda9e7d6353c437048c5a6df1dc6617650333049092
$ pip install torch-2.5.0-cp310-cp310-linux_aarch64.whl
$ wget http://jetson.webredirect.org/jp6/cu126/+f/5f9/67f920de3953f/torchvision-0.20.0-cp310-cp310-linux_aarch64.whl#sha256=5f967f920de3953f2a39d95154b1feffd5ccc06b4589e51540dc070021a9adb9
$ pip install torchvision-0.20.0-cp310-cp310-linux_aarch64.whl 

Also virtual env is recommend.

Thanks

This fixed it. Thank you!

1 Like

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