ImportError:libcublas.so.8.0:无法打开共享对象文件

时间:2018-02-03 17:42:31

标签: python tensorflow importerror

我安装了tensorflow-gpu。我正在使用Tensorflow的virtualenv安装。

Ubuntu version 16.04
Cuda compilation tools, release 7.5, V7.5.17
Nvidia Driver:390 (latest)

我已经将cuda链接到我的.bashrc:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-9.1/extras/CUPTI/lib64

当我尝试:

import tensorflow as tf

我收到以下错误:

>>> import tensorflow
Traceback (most recent call last):
  File "/home/rosi/udacity/TensorFlow/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/rosi/udacity/TensorFlow/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/rosi/udacity/TensorFlow/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/home/rosi/udacity/TensorFlow/lib/python3.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/home/rosi/udacity/TensorFlow/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: libcublas.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 "/home/rosi/udacity/TensorFlow/lib/python3.5/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/home/rosi/udacity/TensorFlow/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/rosi/udacity/TensorFlow/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 72, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/rosi/udacity/TensorFlow/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/rosi/udacity/TensorFlow/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/rosi/udacity/TensorFlow/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/home/rosi/udacity/TensorFlow/lib/python3.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/home/rosi/udacity/TensorFlow/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory


Failed to load the native TensorFlow runtime.

如何解决此问题?

1 个答案:

答案 0 :(得分:1)

在最后一次升级之后,我在使用deb(网络)的Ubuntu 16.04上遇到了与nvidia-390.30和CUDA 9.1相同的问题。 nvidia-smi命令失踪了。 / usr / local / cuda / extras / demo_suite / deviceQuery返回错误35。

问题浮出水面,因为当我运行以下命令时:

# prime-select query

它正在返回undefined

由于我没有板载intel GPU,我以root身份运行以下命令

# prime-select nvidia

然后在调整用户个人资料和其他链接时重新登录。 现在CUDA 9.1与Nvidia驱动程序390.30 :)一起使用,nvidia-smi命令也开始工作。

注意:使用Optimus设置(英特尔GPU)的用户可能需要尝试此操作:

# prime-select intel

我跑了

/usr/local/cuda/extras/demo_suite/deviceQuery

它完美地检测到了设备。