Tensorflow: ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory

匿名 (未验证) 提交于 2019-12-03 08:30:34

问题:

I'm having problems in importing tensorflow in python3:

>>> import tensorflow as tf Traceback (most recent call last):   File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in      from tensorflow.python.pywrap_tensorflow_internal import *   File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in      _pywrap_tensorflow_internal = swig_import_helper()   File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper     _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)   File "/usr/lib/python3.5/imp.py", line 242, in load_module     return load_dynamic(name, filename, file)   File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic     return _load(spec) ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory  During handling of the above exception, another exception occurred:  Traceback (most recent call last):   File "", line 1, in    File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in      from tensorflow.python import *   File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 51, in      from tensorflow.python import pywrap_tensorflow   File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in      raise ImportError(msg) ImportError: Traceback (most recent call last):   File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in      from tensorflow.python.pywrap_tensorflow_internal import *   File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in      _pywrap_tensorflow_internal = swig_import_helper()   File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper     _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)   File "/usr/lib/python3.5/imp.py", line 242, in load_module     return load_dynamic(name, filename, file)   File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic     return _load(spec) ImportError: libcusolver.so.8.0: 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. 

I am using Nvidia drivers version 381.09 beta, as version 375 has this bug: https://askubuntu.com/questions/896221/strange-artifacts-along-window-borders-after-waking-computer-from-sleep-mode?noredirect=1&lq=1

I have install CUDA 8.0 and cuDNN-v6.0:

rharish@rharish-GL552VW:~$ cd /usr/local rharish@rharish-GL552VW:/usr/local$ ls bin         cuda      etc    include  man   share computecpp  cuda-8.0  games  lib      sbin  src 

Also, libcusolver.so.8.0 exists in /usr/local/cuda/lib64/:

libcusolver.so.8.0 in 'ls' output

I have uninstalled and reinstalled CUDA, cuDNN, and built tensorflow from sources. This problem has been occuring since updating the Nvidia drivers to version 381.09 beta. Any help?

回答1:

Found the solution:

I reinstalled nvidia-381, CUDA-8.0 (using the runfile) and cuDNN 6.0. Then I added the following in my .bashrc:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64/ 


回答2:

No need for reinstallation. Install nvidia-cuda-dev:

sudo apt install nvidia-cuda-dev 

Install cuDNN (which you download from https://developer.nvidia.com/cudnn), and set LD_LIBRARY_PATH accordingly (to cuda/lib64).



回答3:

You could be having this problem if you installed the latest version of CUDA (9.0). If this is the case, you'll have the libcusolver.so.9.0 file or directory on your computer, but not 8.0, so python can't find it to import. Tensorflow doesn't yet support CUDA 9.0 (as of Oct 18th 2017).

To fix this, install CUDA 8.0, which can be found here. You can find all their legacy releases at the bottom of the main download page.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!