Robot Nr.5 Robot Nr.5 - 1 month ago 32
Python Question

Error importing tensorflow, libcudnn.so not locateable

I try to get Tensorflow working, but when I try to validate the installation with the example from their guide, it returns an error. Here is the full output:

uburobot@uburobot:~$ source /opt/tensorflow/bin/activate
(tensorflow)uburobot@uburobot:~$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory


Installation path is /opt/ where I placed cuda and also tensorflow. $ locate libcudnn.so.5 returns me nothing. Versions are Cuda 8.0 and cuDNN 5.1.
Everything besides this is functional. I used the nvidia guide to install Cuda and verified the installation with the given examples (worked). Adding export LD_LIBRARY_PATH=/usr/local/cuda/lib64/ to bashrc doesn't do anything.

Answer Source

As I know, the default installation path of cuda is /usr/local/cuda and /usr/local/cuda-8.0.If your cuda was installed in the default path, you could export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64/ to bashrc or add /usr/local/cuda-8.0/lib64 to the /etc/ld.so.conf.d/cuda.conf, then run ldconfig in the terminal.

Your cudnn library may be installed incorrectly. You need copy the cudnn.h to /usr/local/cuda-8.0/include, then copy the libcudnn_static.a and libcudnn.so.5.1.5 to /usr/local/cuda-8.0/lib64. run cd /usr/local/cuda-8.0/lib64 sudo ln -s libcudnn.so.5.1.5 libcudnn.so.5 sudo ln -s libcudnn.so.5 libcudnn.so