當前位置: 首頁>>技術問答>>正文


Tensorflow:ImportError:libcusolver.so.8.0:無法打開共享對象文件:沒有這樣的文件或目錄

在python3中導入tensorflow時遇到了import error問題:

>>> 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測試版,因為版本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,並且從源代碼構建了tensorflow。從更新Nvidia驅動程序到版本381.09測試版已經發生此問題。任何幫助?

最佳解決思路

我遇到了同樣的問題,解決辦法如下:

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

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

次佳解決思路

無需重新安裝。安裝nvidia-cuda-dev

sudo apt install nvidia-cuda-dev

安裝cuDNN(您從https://developer.nvidia.com/cudnn下載),並相應地設置LD_LIBRARY_PATH(到cuda/lib64)。

tensorflow import error

參考資料

本文由《純淨天空》出品。文章地址: https://vimsky.com/zh-tw/article/3744.html,未經允許,請勿轉載。