简体   繁体   English

在ubuntu18.04中导入错误tensorflow-gpu

[英]Import error tensorflow-gpu in ubuntu18.04

I'm getting some error while importing tensorflow. 导入张量流时出现一些错误。

My computer's Specifications: 我的电脑规格:

OS:ubuntu 18.04 作业系统:ubuntu 18.04

Nvidia RTX 2080 Ti*2 英伟达RTX 2080 Ti * 2

Nvidia driver-415 Nvidia驱动程序415

CUDA:10.0 CUDA:10.0

cuDNN:7.3.0 tensorflow:1.11.0 cuDNN:7.3.0张量流:1.11.0

import tensorflow

Error: 错误:

Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "/usr/local/lib/python3.6/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.6/imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "/usr/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 追溯(最近一次通话):文件“ /usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py”,行58,来自tensorflow.python.pywrap_tensorflow_internal import *文件“ / usr /local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py“,第28行,在_pywrap_tensorflow_internal = swig_import_helper()文件中,” / usr / local / lib / python3.6 / dist-packages / tensorflow / python / pywrap_tensorflow_internal.py”,第24行,在swig_import_helper _mod = imp.load_module('_ pywrap_tensorflow_internal',fp,路径名,描述),文件“ /usr/lib/python3.6/imp.py”,第243行,在load_module返回中load_dynamic(名称,文件名,文件)文件“ /usr/lib/python3.6/imp.py”,第343行,在load_dynamic中返回_load(spec)ImportError:libcublas.so.9.0:无法打开共享库文件:否这样文件或目录

During handling of the above exception, another exception occurred: 在处理上述异常期间,发生了另一个异常:

Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.6/dist-packages/tensorflow/ init .py", line 22, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ init .py", line 49, in from tensorflow.python import pywrap_tensorflow File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorfl 追溯(最近一次调用):文件“”,行1,位于文件“ /usr/local/lib/python3.6/dist-packages/tensorflow/ init .py”,行22,来自tensorflow.python import pywrap_tensorflow #pylint:disable = unused-import文件“ /usr/local/lib/python3.6/dist-packages/tensorflow/python/ init .py”,行49,来自tensorflow.python import pywrap_tensorflow文件“ / usr / local” /lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py“,行74,在抬高ImportError(msg)ImportError:追溯(最近一次调用):文件” / usr / local / lib / python3。 6 / dist-packages / tensorflow / python / pywrap_tensorflow.py“,第58行,来自tensorflow.python.pywrap_tensorflow_internal import *文件” /usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal。 py”,_ pywrap_tensorflow_internal = swig_import_helper()中的第28行,文件“ /usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py”,第24行,位于swig_import_helper _mod = imp.load_module(' _pywrap_tensorfl ow_internal', fp, pathname, description) File "/usr/lib/python3.6/imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "/usr/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 ow_internal',fp,路径名,描述)文件“ /usr/lib/python3.6/imp.py”,第243行,在load_module中返回load_dynamic(名称,文件名,文件)文件“ /usr/lib/python3.6/ imp.py“,行343,在load_dynamic中返回_load(spec)ImportError:libcublas.so.9.0:无法打开共享库文件:没有这样的文件或目录

Failed to load the native TensorFlow runtime. 无法加载本地TensorFlow运行时。

See https://www.tensorflow.org/install/install_sources#common_installation_problems 请参阅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. 寻求帮助时,在此错误消息上方包括整个堆栈跟踪。

I already tried to use ubuntu 16.04 ,but GPU didn't support. 我已经尝试使用ubuntu 16.04,但是GPU不支持。 Installation of CUDA9.0 & CUDA9.2 was not supported too. 也不支持安装CUDA9.0&CUDA9.2。

how can I use tensorflow-gpu? 我如何使用tensorflow-gpu?

I already app path in ~/.bashrc 我已经在〜/ .bashrc中应用了路径

export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/local/cuda-10.0
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64$LD_LIBRARY_PATH

The tensorflow-gpu package is built against Cuda 9.0, but you have Cuda 10.0 installed. tensorflow-gpu软件包是针对Cuda 9.0构建的,但是您已经安装了Cuda 10.0。

You need either to downgrade your version of Cuda to 9.0 (but if I recall, that's not possible with a 2080Ti), or build tensorflow from the sources. 您需要将Cuda的版本降级到9.0(但如果我记得,使用2080Ti是不可能的),或者从源代码构建tensorflow。 There is extensive documentation on how to do so on the tensorflow webiste tensorflow Webiste上有大量有关如何执行此操作的文档

You can also try to install the package tf-nightly-gpu . 您也可以尝试安装软件包tf-nightly-gpu You should note that this version is more experimental though, as it has not been tested as extensively. 您应该注意,该版本是更具实验性的,因为尚未经过广泛的测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM