Error after installing pip tensorflow-gpu with cud

2020-04-19 06:36发布

I want to use only the pip version of tensorflow as in conda version if tensorflow-gpu gets error code runs on cpu which is undesirable.

After installing cuda 10 and cudnn for ubuntu 18.0.4 when I import tensorflow it gives me the following error.

PS: I purged everything related to cuda and Nvidia and then installed the new Cuda 10.

Python 3.6.7 |Anaconda custom (64-bit)| (default, Oct 23 2018, 19:16:44) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

>>> import tensorflow

Traceback (most recent call last): File "/home/purav/anaconda3/envs/purav/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "/home/purav/anaconda3/envs/purav/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "/home/purav/anaconda3/envs/purav/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/purav/anaconda3/envs/purav/lib/python3.6/imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "/home/purav/anaconda3/envs/purav/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 "", line 1, in File "/home/purav/anaconda3/envs/purav/lib/python3.6/site-packages/tensorflow/init.py", line 24, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "/home/purav/anaconda3/envs/purav/lib/python3.6/site-packages/tensorflow/python/init.py", line 49, in from tensorflow.python import pywrap_tensorflow File "/home/purav/anaconda3/envs/purav/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "/home/purav/anaconda3/envs/purav/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "/home/purav/anaconda3/envs/purav/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "/home/purav/anaconda3/envs/purav/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/purav/anaconda3/envs/purav/lib/python3.6/imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "/home/purav/anaconda3/envs/purav/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
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory

I don't know why this error is there I don't have cuda verison 9

3条回答
smile是对你的礼貌
2楼-- · 2020-04-19 07:15

The issue is you haven't fully satisfied the TensorFlow GPU requirements.
The full list is here on the TF website.

The main cause of your error seems that you don't have the CUDA toolkit 9.0 configured well with the cuDNN SDK please note you need a version greater or equal to 7.2 and add it to your system path.

查看更多
何必那么认真
3楼-- · 2020-04-19 07:24

The current stable version of tensorflow-gpu available through pip is v1.12 which is built against CUDA 9.0. If you look at issue number 22706 of tensorflow github repository, the official binaries of upcoming tensorflow-gpu v1.13 are expected to be built against CUDA 10.

As of 23 January 2019, the rc0 version of tensorflow-gpu v1.13 has been released which has been built against CUDA 10. It can be installed using pip by specifying the version as follows:

pip install tensorflow-gpu==1.13.0rc0

Since CUDA 9 has been replaced with CUDA 10 in your system, the default tensorflow-gpu code is failing because it is version 1.12 and expecting CUDA 9 binaries to be present in the system. So currently, if you want to use tensorflow with CUDA 10, then the quickest solution is to upgrade your tensorflow version as specified above.

查看更多
孤傲高冷的网名
4楼-- · 2020-04-19 07:29

I am running python 3.7 and was able to install tensorflow with cuda 10 by running :

 pip install --no-cache-dir https://github.com/evdcush/TensorFlow-wheels/releases/download/tf-1.12.0-py37-gpu-10.0/tensorflow-1.12.0-cp37-cp37m-linux_x86_64.whl
查看更多
登录 后发表回答