Tensorflow:ImportError:libcusolver.so.8.0:无法打开共享对象文件:没有这样的文件或目录

时间:2017-04-22 11:32:58

标签: tensorflow

我在python3中导入tensorflow时出现问题:

>>> 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 <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _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 "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 51, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
    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 <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _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.

我正在使用Nvidia驱动程序版本381.09 beta,因为版本375有此错误:https://askubuntu.com/questions/896221/strange-artifacts-along-window-borders-after-waking-computer-from-sleep-mode?noredirect=1&lq=1

我已经安装了CUDA 8.0和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

另外,libcusolver.so.8.0存在于/ usr / local / cuda / lib64 /:

libcusolver.so.8.0 in 'ls' output

我已经卸载并重新安装了CUDA,cuDNN,并从源代码构建了张量流。自从将Nvidia驱动程序更新到版本381.09 beta后,就出现了此问题。有什么帮助吗?

5 个答案:

答案 0 :(得分:40)

找到解决方案:

我重新安装了nvidia-381,CUDA-8.0(使用runfile)和cuDNN 6.0。然后我在.bashrc中添加了以下内容:

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

答案 1 :(得分:9)

无需重新安装。安装nvidia-cuda-dev

sudo apt install nvidia-cuda-dev

安装cuDNN(您从https://developer.nvidia.com/cudnn下载),然后相应地设置LD_LIBRARY_PATH(到cuda/lib64)。

答案 2 :(得分:4)

如果安装了最新版本的CUDA(9.0),可能会遇到此问题。如果是这种情况,您将拥有计算机上的libcusolver.so.9.0文件或目录,但不是8.0,因此python无法找到它进行导入。 Tensorflow尚不支持CUDA 9.0(截至2017年10月18日)。

要解决此问题,请安装CUDA 8.0,可以找到here。您可以在主下载页面的底部找到所有legacy releases

答案 3 :(得分:0)

除了正确设置路径外,已安装的Tensorflow版本必须与系统中具有的CUDA驱动程序版本兼容,否则它将无法正常工作。 参见link

答案 4 :(得分:0)

由于Tensorflow版本与CUDA不兼容,我遇到了此错误。 我有tensorflow_gpu-1.3.0CUDA 9cuDNN 7与此https://www.tensorflow.org/install/source#tested_build_configurations

不兼容

所以我卸载了tensorflow_gpu-1.3.0并安装了tensorflow_gpu-1.5.0,它工作正常