简体   繁体   中英

Could not load dynamic library 'libcudnn.so.8'

I'm using cuda 11.0, with cudnn 8.0.5, tensorflow 2.4 the error I got from runnning my code was this,

2021-10-28 17:28:12.120217: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcudnn.so.8'; dlerror: libcudnn.so.8: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/ahn/anaconda3/envs/imageai/lib/python3.7/site-packages/cv2/../../lib64:

I thought this was a cudnn installation error and have tried installing both cudnn 8.0.4 and 8.0.5 both giving me the same error, the path in the error above doesn't exist and I'm guessing the error has to do something with the requirements I installed. Many thanks to those willing to help me!

Check cuda folders:

gediz@u18serv:~$  ls /usr/local |grep cuda
cuda
cuda-11
cuda-11.5

Check cudnn libraries:

gediz@u18serv:~$ ls /usr/local/cuda-11.5/lib64/libcudnn.so.8*
/usr/local/cuda-11.5/lib64/libcudnn.so.8  /usr/local/cuda-11.5/lib64/libcudnn.so.8.2.4

If it is there add set permissions and add to path:

sudo chmod a+r /usr/local/cuda/include/cudnn*.h 
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*


export PATH=/usr/local/cuda-11.5/bin:${PATH}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH=/usr/local/cuda-11.5/lib64:${LD_LIBRARY_PATH}
export CUDA_HOME=/usr/local/cuda

Adjust paths according to the version of cuda you want to use. I have installed two cuda toolkits one from NVIDIA web other from apt-get nvidia-cuda-toolkit

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM