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

Error importing tensorflow, 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/", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: cannot open shared object file: No such file or directory

Installation path is /opt/ where I placed cuda and also tensorflow. $ locate 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/, 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 to /usr/local/cuda-8.0/lib64. run cd /usr/local/cuda-8.0/lib64 sudo ln -s sudo ln -s