tensorflow: Import Error Couldn't open CUDA library libcudnn.so.5.

What related GitHub issues or StackOverflow threads have you found by searching the web for your problem?

i was installing tensorflow GPU version on ubuntu x86-64 but I found an error:

>>> import tensorflow as tf I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:126] Couldn't open CUDA library libcudnn.so.5. LD_LIBRARY_PATH: /home/lunasdejavu/Downloads:/usr/local/cuda-8.0/lib64 I tensorflow/stream_executor/cuda/cuda_dnn.cc:3517] Unable to load cuDNN DSO I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally

i tried to install again and again follow the instructions it is still useless. I tried the NVIDIA_CUDA-8.0_Samples then make. no error after all

can somebody help me… i was working on this setting for almost 24 hours…

Environment info

Operating System: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 64 bit Installed version of CUDA and cuDNN: (please attach the output of ls -l /path/to/cuda/lib/libcud*): i can’t use the command

but the packages are cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb cudnn-8.0-linux-x64-v6.0.tgz

If installed from binary pip package, provide: https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl

  1. A link to the pip package you installed:
  2. The output from python -c "import tensorflow; print(tensorflow.__version__)".

If installed from source, provide

  1. The commit hash (git rev-parse HEAD)
  2. The output of bazel version Build label: 0.4.5 Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Thu Mar 16 12:19:38 2017 (1489666778) Build timestamp: 1489666778 Build timestamp as int: 1489666778

If possible, provide a minimal reproducible example (We usually don’t have time to read hundreds of lines of your code)

What other attempted solutions have you tried?

i searched the manual of th cd <installpath> export LD_LIBRARY_PATH=pwd:$LD_LIBRARY_PATH

Add <installpath> to your build and link process by adding -I<installpath> to your compile
line and -L<installpath> -lcudnn to your link line.

Logs or other output that would be helpful

(If logs are large, please upload as attachment or provide link).

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 20 (3 by maintainers)

Most upvoted comments

Shouldn’t the solution be adding it the permanent library config path? instead of export LD_LIBRARY_PATH=/usr/local/cuda/lib64/ you can do

sudo sh -c "echo '/usr/local/cuda/lib64\n/usr/local/cuda/lib' >> /etc/ld.so.conf.d/nvidia.conf"

sudo ldconfig

i still can’t fix this problem ls -l /path/to/cuda/lib/libcud* ls: cannot access '/path/to/cuda/lib/libcud*': No such file or directory but i knew how to fix the original problem. Tensorflow hasn’t supported cudnn 6.0 yet. so i changed to cudnn5.1. it is working now.

This is what I did (I think - I’ve retraced my steps, removing and recreating links and clearing the LD_LIBRARY_PATH in order to reproduce the problem).

(tensorflow)$python

import tensorflow

Everything breaks loose [lots of messages] ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory

I registered as a developer and downloaded libcudnn.so.6,the latest, as some had suggested. I installed with dpkg or gdebi (wrapper - cannot remember, it was very late) With these packages/installers things may end up in /etc/alternatives, or /usr/targets/x86_64/…, with a link to them somewhere not in your paths

So … used ln to create a link. I don’t care that it’s actually libcudnn.so.6 … I’m doing this as an experiment. Some say 6 works and it’s the latest for cuda toolkit 8.

sudo ln -s /etc/alternatives/libcudnn_so /usr/local/cuda/lib64/libcudnn.so.5

We get this link /usr/local/cuda/lib64/libcudnn.so.5 -> /etc/alternatives/libcudnn_so Add /usr/local/cuda/lib64 to your LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64

Then in my tensorflow environment things are quiet

(tensorflow) dude@beauty:~/tensorflow$ python Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type “help”, “copyright”, “credits” or “license” for more information.

import tensorflow

Hopefully this will work in your system.

I have cudnn7 installed in /opt/cuda/lib64

sudo ln -s libcudnn.so.7.0.1 libcudnn.so.5 

fixed the

ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory

Seems to be working ok. Of course, since cudnn5.1 is the officially supported version, might be setting myself up for future pain!

@Kevinpsk After upgrading to TensorFlow 1.3, first I got the error

ImportError: libcudnn.so.6: cannot open shared object file: No such file or directory

Then I did the following

cd /opt/cuda/lib64
sudo ln -s libcudnn.so.7.0.1 libcudnn.so.6

This fixed the problem. Again, since cudNN 6 is the officially supported version, this might create problems down the line. TensorFlow 1.4 will be officially on cudNN 7.

So, AFAICT, cudNN upgrade might fix the problem you are seeing.

Upgrade cudnn to version 6

From the issue template:

Installed version of CUDA and cuDNN:
(please attach the output of ls -l /path/to/cuda/lib/libcud*):
i can't use the command

Until you can find out what files are in there, it’s going to be hard for you to see if there libcudnn in there, you’re going to have difficulty solving the problem. You could install libcudnn in a different directory and add it to your LD_LIBRARY_PATH list.