I'm building TensorFlow from source code. The build appears to succeed; however, when my TensorFlow program invokes import tensorflow
, one or both of the following errors appear:
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory
ImportError: libcudnn.5: cannot open shared object file: No such file or directory
First, for the following error:
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory
make sure your LD_LIBRARY_PATH
includes your lib64
directory in whichever path you installed your cuda package in. You can do this by adding an export
line in your .bashrc
. For Omar, it looked like the following:
I fixed this just adding the cuda path to my .bashrc
export LD_LIBRARY_PATH=/usr/local/cuda/lib64/
For me, I had to do Omar's line and also: export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64/
because I have two directories involving cuda (probably not the best).
Second, are you sure you installed cuDNN? Note that this is different from the regular cuda package. You will need to register, then download and install the package from the following page: https://developer.nvidia.com/cudnn
Third, I had this same problem:
ImportError: libcudnn.5: cannot open shared object file: No such file or directory
It turns out there is no libcudnn.5
in my /usr/local/cuda/lib64
or /usr/local/cuda-8.0/lib64
directories. However, I do have a libcudnn.so.6.*
file. To solve the problem, I created a soft link:
ln -s libcudnn.so.6.* libcudnn.so.5
in my /usr/local/cuda/lib64
directory. Now everything works for me. Your directory might be different if you already had cuDNN
, and your libcudnn.so.6.*
might be a different version, so check that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With