I am trying to load a tensorflow project. It will be using a GPU
Everytime I import tensorflow I get an error:
sys.path
Out[5]:
['',
'/usr/local/lib/python2.7/dist-packages/spyder/utils/site',
'/usr/local/cuda/lib64',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/local/lib/python2.7/dist-packages/IPython/extensions',
'/home/kevin/.ipython']
import tensorflow
Traceback (most recent call last):
File "<ipython-input-6-a649b509054f>", line 1, in <module>
import tensorflow
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
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
The issue is that I do have the file ( libcudnn.so.5
) in the folder /usr/local/cuda/lib64
ls /usr/local/cuda/lib64/ lib64/ libcudnn.so.5@ libcudnn.so.6.0.21* libcudnn.so@ libcudnn.so.6@ libcudnn_static.a
What is frustrating to me is that I can actually load tensorflow right from ipython in the terminal and from a regular python shell in the terminal. I have this in my .bashrc: export LD_LIBRARY_PATH=/usr/local/cuda/lib64/
But both the python shell and ipython shell in spyder seem to not see the path? Any idea as to what I can do? I had added the path to the PYTHONPATH manager in spyder. I have also added the math to the .profile in my home folder
( Spyder developer here ) You need to start Spyder from a system terminal to solve this problem.
This happens because when Spyder is started from Unity, it doesn't grab the environment variables defined in a terminal.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.