But after importing Pytorch I got the following error:
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/<username>/miniconda3/envs/<envname>/lib/python3.8/site-packages/torch/__init__.py", line 229, in <module>
from torch._C import * # noqa: F403
ImportError: libcudnn.so.8: cannot open shared object file: No such file or directory
When I install PyTorch following the guide from docs.nvidia.com I got the error right after importing torch library so I cannot print output of torch and cudnn versions:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/.../miniconda3/envs/.../lib/python3.8/site-packages/torch/__init__.py", line 229, in <module>
from torch._C import * # noqa: F403
ImportError: libcudnn.so.8: cannot open shared object file: No such file or directory
If I install PyTorch with the alternative command I mentioned I got the following outputs:
2.1.0
None
I was installing PyTorch compilation for JP v5.3 but it seems I actually have v5.1. However, I got the same outputs if I install PyTorch from: pip3 install --pre torch==2.1 --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v51
Just in case, this is the output from nvcc --version:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Sun_Oct_23_22:16:07_PDT_2022
Cuda compilation tools, release 11.4, V11.4.315
Build cuda_11.4.r11.4/compiler.31964100_0
I hope these details could help to solve the problem.
I tried installing it outside of the virtual environment following the installation guide but I’m still having the same error after importing PyTorch:
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/<username>/.local/lib/python3.8/site-packages/torch/__init__.py", line 229, in <module>
from torch._C import * # noqa: F403
ImportError: libcudnn.so.8: cannot open shared object file: No such file or directory
I’m also using Python 3.8 outside of the virtual environment.
It seems that some file or directory related with cudnn is missing so I added this to my ~/.bashrc but it made no effect: