libcublas.so.9.0 没有这个文件或目录。

3

导入tensorflow时出现错误。

我的环境

  • Ubuntu 18.04桌面版
  • Nvidia显卡驱动程序470.42.01
  • CUDA 11.4
  • Python 3.6.14(Anaconda)
  • TensorFlow-gpu 1.12.0

CUDA环境变量设置已完成(11.4) 在/usr/local/CUDA下建立了符号链接,指向/usr/local/CUDA-11.4

(使用旧版本的原因是项目的SDK是以前编写的。)

在运行Python后导入tensorflow时,会出现以下错误:

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

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

我安装了CUDA 9.0来解决这个错误。 然而,在7.0版本中仍旧出现了同样的错误。

我需要安装我需要的所有CUDA版本吗? 还是有其他方法可以解决这个问题?


如果您安装了CUDA 9.0,您会收到一个不同的错误(很可能是关于cudnn),而不是版本7.0相同的错误。 - undefined
2个回答

1
根据Tensorflow文档,TF v1.12需要CUDA 9.0。 查看屏幕截图以获取信息,enter image description here 一旦安装了适当的CUDA版本,请将CUDA®、CUPTI和cuDNN安装目录添加到%PATH%环境变量中。 按照此处提供的安装步骤,并根据需要更改CUDA版本,即CUDA 9.0。

1
当我运行poetry lock时,我从我的锁定文件中删除了以下条目,导致出现了这个错误:
[[package]]
name = "nvidia-cublas-cu11"

我的决心是运行poetry lock --no-update


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接