Tensorflow:ImportError:libcusolver.so.8.0

时间:2021-08-13 03:44:33

I recently upgraded my graphics card on my Linux machine. I installed NVIDIA driver versioned 384, cudnn and manually installed CUDA-Toolkit 8 to opt out the included old drivers.

我最近在Linux机器上升级了我的显卡。我安装了NVIDIA driver版本为384、cudnn和手动安装CUDA-Toolkit 8,以选择不包含旧驱动。

I compiled the "NVIDIA_CUDA-8.0_Samples" and ran the binary file generated named "deviceQuery" it passed and worked fine.

我编译了“NVIDIA_CUDA-8.0_Samples”,并运行生成的名为“deviceQuery”的二进制文件。

I get the following error when trying to run my code:

当我试图运行我的代码时,我得到以下错误:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.6/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.6/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.6/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 "/home/ben/Documents/GitHub/Machine-Learning/polynomial_fitting/poly_fit.py", line 5, in <module>
    import tensorflow as tf
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python3.6/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.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.6/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.6/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.6/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.
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.6/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.6/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.6/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 "/home/ben/Documents/GitHub/Machine-Learning/polynomial_fitting/poly_fit.py", line 5, in <module>
    import tensorflow as tf
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python3.6/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.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.6/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.6/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.6/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 tried following:

我试着:

  1. http://blog.nelsonliu.me/2017/04/29/installing-and-updating-gtx-1080-ti-cuda-drivers-on-ubuntu/
  2. http://blog.nelsonliu.me/2017/04/29/installing和更新- gtx 1080 - ti - - ubuntu/ cuda -驱动程序
  3. Tensorflow: ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory
  4. 不能打开共享对象文件:没有这样的文件或目录
  5. After building TensorFlow from source, seeing libcudart.so and libcudnn errors
  6. 从源头上建立了TensorFlow之后,看到了libcudart。所以和libcudnn错误

Yet no results. Currently I have in my "~/.bashrc" at the EOF the two following lines:

但是没有结果。目前我有在我的“~/”。在以下两行EOF中,bashrc:

export LD_LIBRARY_PATH=/usr/local/cuda/lib64/
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64/

I do have the file "libcusolver.so.8.0" at the sub-dir "lib64", so I guess it's a linking problem. DISCLAIMER: I am relatively a new user to Linux and perhaps and I don't possess the knowledge about "soft links, the full purpose of ".bashrc", "etc/environment" and such.

我在子目录“lib64”中有一个名为“libcusolver.so.8.0”的文件,因此我认为这是一个链接问题。免责声明:我是Linux的新用户,也许我不了解“软链接,完整的目的”。bashrc”、“(等/环境”等。

Thanks in advance, Ben.

提前谢谢,本。

2 个解决方案

#1


3  

For Googlers, 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).

对于谷歌人来说,如果你安装了最新版本的CUDA(9.0),你可能会遇到这个问题。如果是这种情况,那么您的计算机上将有libcusolver.so.9.0文件或目录,但不是8.0,因此python无法找到要导入的文件。Tensorflow还不支持CUDA 9.0(截止2017年10月18日)。

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.

要解决这个问题,请安装CUDA 8.0,可以在这里找到。您可以在主下载页面的底部找到他们所有的遗留版本。

If you choose to download the deb (local) installer, the instructions are as follows:

如果您选择下载deb(本地)安装程序,说明如下:

  1. download the base installer from the link above
  2. 从上面的链接下载基本安装程序
  3. cd to the directory where it downloaded to and run sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb
  4. cd下载到该目录并运行sudo dpkg -i cuda-repo-ubuntu1604- 8-08-0local -ga2_8.0.61-1_amd64.deb
  5. sudo apt-get update
  6. sudo apt-get更新
  7. sudo apt-get install cuda-8-0 (The website says install cuda, but that will just install 9.0, you need to add -8-0 for it to install version 8.0)
  8. sudo apt-get install cuda-8-0(网站上说安装cuda,但那只是安装9.0,安装8.0版本需要添加-8-0)

#2


0  

lots of things to check

有很多东西要检查

  • check your env variables LD_LIBRARY_PATH and LD_LIBRARY_PATH are exactly what you want by echo $LD_LIBRARY_PATH
  • 通过echo $LD_LIBRARY_PATH检查env变量LD_LIBRARY_PATH和LD_LIBRARY_PATH正是您想要的
  • check your driver by nvidia-smi
  • 通过nvidia-smi检查你的司机。

#1


3  

For Googlers, 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).

对于谷歌人来说,如果你安装了最新版本的CUDA(9.0),你可能会遇到这个问题。如果是这种情况,那么您的计算机上将有libcusolver.so.9.0文件或目录,但不是8.0,因此python无法找到要导入的文件。Tensorflow还不支持CUDA 9.0(截止2017年10月18日)。

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.

要解决这个问题,请安装CUDA 8.0,可以在这里找到。您可以在主下载页面的底部找到他们所有的遗留版本。

If you choose to download the deb (local) installer, the instructions are as follows:

如果您选择下载deb(本地)安装程序,说明如下:

  1. download the base installer from the link above
  2. 从上面的链接下载基本安装程序
  3. cd to the directory where it downloaded to and run sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb
  4. cd下载到该目录并运行sudo dpkg -i cuda-repo-ubuntu1604- 8-08-0local -ga2_8.0.61-1_amd64.deb
  5. sudo apt-get update
  6. sudo apt-get更新
  7. sudo apt-get install cuda-8-0 (The website says install cuda, but that will just install 9.0, you need to add -8-0 for it to install version 8.0)
  8. sudo apt-get install cuda-8-0(网站上说安装cuda,但那只是安装9.0,安装8.0版本需要添加-8-0)

#2


0  

lots of things to check

有很多东西要检查

  • check your env variables LD_LIBRARY_PATH and LD_LIBRARY_PATH are exactly what you want by echo $LD_LIBRARY_PATH
  • 通过echo $LD_LIBRARY_PATH检查env变量LD_LIBRARY_PATH和LD_LIBRARY_PATH正是您想要的
  • check your driver by nvidia-smi
  • 通过nvidia-smi检查你的司机。