使用GUI时,仅Tensorflow的“ ImportError:libcublas.so.10.0”

时间:2019-04-18 06:32:11

标签: python linux tensorflow centos

我同时安装了GNOME桌面的Centos7最小安装版本。我主要是远程使用终端,但是在使用相机时会使用GUI。

以下是我使用的程序/软件包:

  • Python 3.4.9
  • Tensorflow-gpu 1.13.1
  • CUDA 10.0
  • Nvidia驱动程序481.56

当我使用终端并导入tensorflow时,一切都会按预期运行。

当我启动GUI并尝试在GUI终端上导入tensorflow时,出现典型的导入错误:

>>>import tensorflow as tf
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/lib/python3.4/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 "/usr/lib64/python3.4/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
ImportError: libcublas.so.10.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/lib/python3.4/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/usr/lib/python3.4/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/lib/python3.4/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 "/usr/lib64/python3.4/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

同样,在没有GUI的终端上运行该错误也没有。即使当我打开GUI并遇到此导入错误时,我也将SSH导入我的计算机,并且仍然能够在SSH窗口中导入tensorflow。

我的路径应该没问题,因为它再次成功导入,而不是在GUI上导入时。这是一个非常奇怪的问题,我完全不知道为什么会这样。

我还尝试了各种兼容的tensorflow和Cuda及其他台式机版本。我仍然遇到这个问题。

我想补充一点,我最近重新安装了所有内容,并将其复制到/ home目录中并复制到新安装中。因此,在此之前,无论有没有GUI,一切都可以正常工作。

1 个答案:

答案 0 :(得分:0)

这很奇怪。该错误表明它找不到CUDA10文件(libcublas.so.10.0)的路径。但是,如果您在SSH窗口中导入TF,则不会抱怨。使用GUI打开时是否有防火墙或任何限制在起作用?谢谢!