Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
315 views
in Technique[技术] by (71.8m points)

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

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...