我正在尝试运行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.
我发现了一些类似的问题,但都是针对某些或其他早期版本的Cuda(大多数是8.0)而且我不确定它们是否会起作用。我也尝试了其中一些,比如设置LD_LIBRARY_PATH
但没有任何效果。我也尝试了错误本身的链接,但这也是cuda 8.0的解决方案
答案 0 :(得分:2)
目前,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
答案 1 :(得分:1)
最新的tf 1.5版本现在支持cudnn7和cuda9,通过pip3你现在可以安装1.5版本,但是我仍然有使用docker容器的cuda和tensorflow的问题