Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After building TensorFlow from source, seeing libcudart.so and libcudnn errors

Tags:

tensorflow

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
like image 607
Barry Rosenberg Avatar asked Feb 02 '17 22:02

Barry Rosenberg


1 Answers

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.

like image 157
Luis Valle Avatar answered Oct 09 '22 22:10

Luis Valle