ImportError:libcublas.so.9.0:无法打开共享库文件:即使路径中存在libcublas.so.9.0,也没有此类文件或目录

时间:2018-07-09 14:31:05

标签: tensorflow

我的机器信息:

  • nvcc --version:

    nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2017 NVIDIA Corporation Built on Fri_Sep__1_21:08:03_CDT_2017 Cuda compilation tools, release 9.0, V9.0.176

  • cuda驱动程序版本

    • 版本-9.2
    • 文件-nvidia-diag-driver-local-repo-rhel7-396.26-1.0-1.x86_64.rpm
  • cat / etc / redhat-release: CentOS Linux版本7.5.1804(核心)

cat .bashrc 包括以下内容

PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
CUDA_HOME=$CUDA_HOME:/usr/local/cuda

在此之后,如果我尝试导入火炬或torchvision,则工作正常。但是我导入了tensorflow,不是导入

我的tensorflow版本如下:

  • tensorboard == 1.8.0
  • tensorflow-gpu == 1.8.0

我遇到以下错误:

>>> import tensorflow
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.6/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/local/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/local/lib/python3.6/imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: libcublas.so.9.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.6/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.6/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/local/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/local/lib/python3.6/imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: libcublas.so.9.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.

但是/usr/local/cuda/lib64具有以下内容:

  • libcublas_device.a
  • libcublas.so
  • libcublas.so.9.0
  • libcublas.so.9.0.176
  • libcublas_static.a

我无法找出问题所在。许可是否与此有关?后来我将上述文件的所有者和权限更改为current和755。仍然出现相同的错误。

1 个答案:

答案 0 :(得分:0)

只需将提到的路径添加为您的LD_LIBRARY_PATH为:

 export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH