我正在尝试运行Tensorflow-gpu。
我安装了 Cuda-9.0 和 cuDNN v7.0.3。我测试了两者(如他们的指南中所述)并且它们工作正常。
然后我使用 pip3(我使用 python3)安装了 Tensorflow-gpu,它在导入时给了我这个错误:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, 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: 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 "/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 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 72, 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 58, 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: libcublas.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.
Run Code Online (Sandbox Code Playgroud)
我发现了一些类似的问题,但都是针对某些或其他以前版本的 Cuda(主要是 8.0),我不确定它们是否会起作用。我也尝试了其中的一些,比如设置LD_LIBRARY_PATH但没有任何效果。我还尝试了错误本身中的链接,但这也是 cuda 8.0 的解决方案
目前,TF-GPU 的二进制可安装版本需要 CUDA 8。这将来可能会改变,但对于这些二进制文件,您无法满足 CUDA 9 的要求。
如果您确实想使用 CUDA 9/CUDNN 7,则需要从源代码构建 TF。否则安装 CUDA 8 并将 TF 指向该位置。CUDA 8可以与CUDA 9一起安装,无需修改驱动程序;CUDA 9 GPU 驱动程序将与 CUDA 8 安装一起使用。
您可以在此处的答案中查看更多详细信息: https://devtalk.nvidia.com/default/topic/1026198/cuda-9-0-importerror-libcublas-so-8-0/
我希望这有帮助:D