ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory

简介: ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory

错误:

今天想在实验室的GPU服务器-我的docker容器里使用tensorflow-gpu【安装直接pip install tensorflow-gpu】,结果报错:

1. ImportError: Traceback (most recent call last):
2.   File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
3.     from tensorflow.python.pywrap_tensorflow_internal import *
4.   File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
5.     _pywrap_tensorflow_internal = swig_import_helper()
6.   File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
7.     _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
8.   File "/root/anaconda3/lib/python3.6/imp.py", line 243, in load_module
9.     return load_dynamic(name, filename, file)
10.   File "/root/anaconda3/lib/python3.6/imp.py", line 343, in load_dynamic
11.     return _load(spec)
12. ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory
13. 
14. 
15. Failed to load the native TensorFlow runtime.

原因很简单:tensorflow和docker里的cuda版本不对应:

1. Latest TensorFlow supports cuda 8-10. cudnn 6-7.
2. Each TensorFlow binary has to work with the version of cuda and cudnn it was built with. If they don't match, you have to change either the TensorFlow binary or the Nvidia softwares.
3. Official tensorflow-gpu binaries (the one downloaded by pip or conda) are built with cuda 9.0, cudnn 7 since TF 1.5, and cuda 10.0, cudnn 7 since TF 1.13. These are written in the release notes. You have to use the matching version of cuda if using the official binaries.
4. If you don't like to change your Nvidia software, you can:
5. (1) Use a different version of TensorFlow
6. (2) Use non-official binaries built by others. e.g.: https://github.com/mind/wheels/releases, https://github.com/hadim/docker-tensorflow-builder#builds,
7. https://github.com/inoryy/tensorflow-optimized-wheels
8. (3) Build the binaries by yourself from source with your version of Nvidia software.

安装好对应的版本就好了:更多请参阅这篇文章:https://blog.csdn.net/qq_36396104/article/details/89165185

1. tensorflow-gpu v1.9.0 | cuda9.0 |  cuDNN7.1.4可行  | 备注:7.0.4/ 7.0.5/ 7.1.2不明确
2. 
3. tensorflow-gpu v1.8.0 | cuda9.0 |  cuDNN  不明确 | 备注:7.0.4/ 7.0.5/ 7.1.2/ 7.1.4
4. 
5. tensorflow-gpu v1.7.0 | cuda9.0 |  cuDNN  不明确 | 备注:7.0.4/ 7.0.5/ 7.1.2/ 7.1.4
6. 
7. tensorflow-gpu v1.6.0 | cuda9.0 |  cuDNN  不明确 | 备注:7.0.4/ 7.0.5/ 7.1.2/ 7.1.4
8. 
9. tensorflow-gpu v1.5.0 | cuda9.0 |  cuDNN  不明确 | 备注:7.0.4/ 7.0.5/ 7.1.2/ 7.1.4
10. 
11. tensorflow-gpu v1.4.0 | cuda8.0 |  cuDNN 6.0 | 备注:6.0正常使用, 7.0.5不能用,5.1未知 
12. 
13. tensorflow-gpu v1.3.0 | cuda8.0 |  cuDNN 6.0 | 备注:6.0正常使用, 7.0.5不能用,5.1未知 
14. 
15. tensorflow-gpu v1.2.0 | cuda8.0 |  cuDNN 5.1 | 备注:5.1正常使用, 6.0/ 7.0.5 未知
16. 
17. tensorflow-gpu v1.1.0 | cuda8.0 |  cuDNN 5.1 | 备注:5.1正常使用, 6.0/ 7.0.5 未知

步骤:

1、查看cuda版本:

1. cat /usr/local/cuda/version.txt #shows CUDA Version 9.0.176
2. or
3. nvcc -V

2、安装对应版本的tensorflow【我的是9.0】:

pip install tensorflow-gpu==1.7.0

 

AIEarth是一个由众多领域内专家博主共同打造的学术平台,旨在建设一个拥抱智慧未来的学术殿堂!【平台地址:https://devpress.csdn.net/aiearth】 很高兴认识你!加入我们共同进步!


相关实践学习
部署Stable Diffusion玩转AI绘画(GPU云服务器)
本实验通过在ECS上从零开始部署Stable Diffusion来进行AI绘画创作,开启AIGC盲盒。
目录
相关文章
|
2月前
|
关系型数据库 MySQL
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file
76 0
|
5天前
|
关系型数据库 MySQL
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file
13 2
|
2月前
|
缓存 Ubuntu Linux
error while loading shared libraries: libxcb-icccm.so.4: cannot open shared object file: No such file or directory 问题如何处理
【5月更文挑战第16天】error while loading shared libraries: libxcb-icccm.so.4: cannot open shared object file: No such file or directory 问题如何处理
212 0
|
2月前
|
Java
Java Object 类
5月更文挑战第16天
|
18天前
|
Java
Java中的Object类 ( 详解toString方法 | equals方法 )
Java中的Object类 ( 详解toString方法 | equals方法 )
|
2月前
|
存储 算法 Java
滚雪球学Java(42):探索对象的奥秘:解析Java中的Object类
【5月更文挑战第17天】🏆本文收录于「滚雪球学Java」专栏,专业攻坚指数级提升,希望能够助你一臂之力,帮你早日登顶实现财富自由🚀;同时,欢迎大家关注&&收藏&&订阅!持续更新中,up!up!up!!
30 2
滚雪球学Java(42):探索对象的奥秘:解析Java中的Object类
|
1月前
|
Java
【Java】Object类简单解析
【Java】Object类简单解析
16 1
|
1月前
|
前端开发 JavaScript Java
Java基础10-深入理解Class类和Object类(二)
Java基础10-深入理解Class类和Object类(二)
25 5
|
1月前
|
Java C++
Java基础10-深入理解Class类和Object类(一)
Java基础10-深入理解Class类和Object类(一)
25 4
|
2月前
|
Java
【JAVA学习之路 | 基础篇】Object类及重写的equals()与toString()
【JAVA学习之路 | 基础篇】Object类及重写的equals()与toString()