• Register
0 votes
233 views

Problem :

I have installed Cuda 10.1 and cudnn on Ubuntu 18.04 for the first time and it seems to be installed properly as when I type nvcc and nvidia-smi I am getting proper response.

I have also installed tensorflow using following command:

user:~$ sudo pip3 install --upgrade tensorflow-gpu

But when I am trying to import tensorflow I am getting following error about libcublas.so.10.0:

user:~$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_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.10.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/dist-packages/tensorflow/__init__.py", line 24, in <module>
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 <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python3.6/dist-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/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_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.10.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.

Am I missing something? How to resolve this issue?

9 7 4
38,600 points

Please log in or register to answer this question.

1 Answer

0 votes

 Solution:

The Issue is brought about by your present version of cuda which is 10.1 (as should be obvious from the upper right corner of your picture).

As you can see it from TF official website.

Version                 cuDNN    CUDA
tensorflow-2.1.0         7.6       10.1
tensorflow-2.0.0         7.4       10.0
tensorflow_gpu-1.14.0    7.4       10.0
tensorflow_gpu-1.13.1    7.4       10.0

So you can upgrade your tf to 2.1 or downgrade your cuda with:

conda install cudatoolkit=10.0.130

So it would also automatically downgrade your cudnn.

However changing my version of tensorflow solved my problem.

You will need to update your LD_LIBRARY_PATH, to point to the /usr/local/cuda-9.0/lib64. Add the following line to your .bashrcfile (or whatever other terminal you use)

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

Tensorflow binaries are not compatible with Cuda 9.1 as of now. So the solution could be to just install Tensorflow.

I also had the problem once mentioned above while installing Cuda 9.1 + cuDNN 6 for Tensorflow and this is what worked for me.

Additionally, you have the following two options:

  1. CUDA 8.0 + Tensorflow - The most stable version of CUDA that works with Tensorflow binaries.

  2. CUDA 9.0 + Tensorflow - The latest version of CUDA that Tensorflow binaries are compatible with.

 Try the following code too.

 pip3 install --upgrade tensorflow-gpu==1.4

After typing this command pip3 install --upgrade tensorflow-gpu==1.4in the terminal, the tensor flow will drop to 1.4.0. This error caused by tensorflow 1.6.0.

Tensorflow version 1.5 also required CUDA version 8.0, So, if you have CUDA version 8.0 you can downgrade your version of tensorflow to 1.4.

pip install tensorflow-gpu==1.4

I tried installing tf in an Anaconda environment and had the same problem. After installing CUDA and cuDNN I had to create a new environment first and then in that environmentpip install tensorflow-gpu

Also, 

Every time you install a new version of cuda, you should check the permanent path that may have been added.

to check this in terminal execution

gedit ~/.bashrc

If you see that the old Cuda path is there, you should change it for the new one.

for example mine was:

export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:/usr/lib/nvidia-384

I changed both the cuda path and the nvidia path as I also updated the driver to:

export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:/usr/lib/nvidia-390

I hope that helps :)

11 6 5
96,500 points

Related questions

0 votes
1 answer 266 views
266 views
Problem : I have installed Cuda 10.1 and cudnn on Ubuntu 18.04 for the first time and it seems to be installed properly as when I type nvcc and nvidia-smi I am getting proper response. I have also installed tensorflow using following command: user:~$ sudo ... solutions. Include the entire stack trace above this error message when asking for help. Am I missing something? How to resolve this issue?
asked Nov 27, 2019 alecxe 7.5k points
0 votes
2 answers 103 views
103 views
Problem : I have recently installed the cuda 8.0 and cuda 9.0 in the Gpu support system. I encountered the below error while importing from the keras module. It says it is unable to load the native tensorflow runtime. I have received the error log as below: Traceback ... is, Cuda compilation tools, release 8.0, V8.0.61 Is it the clash between two cuda versions? Have anyone solved this before?
asked Feb 18, 2020 mphil 2.3k points
0 votes
1 answer 122 views
122 views
Problem : I am very new to tensorflow-gpu, I want to use the tensorflow-gpu on my system. I have already tried to reinstall tensorflow-gpu many times but still it shows me the following error.If I use the tensorflow-cpu then it works correctly. Please Note: I ... ) ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory Can somebody help me in fixing above error ?
asked Feb 19, 2020 mphil 2.3k points
0 votes
1 answer 1.6K views
1.6K views
Problem : I am facing following error : ImportError: libcuda.so.1: cannot open shared object file: No such file or directory Failed to load the native TensorFlow runtime. Above error comes up when I tried to import the tensorflow. Is there anybody who has faced this error before and know the solution on it?
asked Dec 10, 2019 alecxe 7.5k points
0 votes
1 answer 281 views
281 views
Problem : I am building the TensorFlow from the source code. The build appears to succeed; but, when my TensorFlow program invokes the import tensorflow, one or both of the following errors starts appearing: · ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory · ImportError: libcudnn.5: cannot open shared object file: No such file or directory
asked Dec 9, 2019 alecxe 7.5k points
0 votes
1 answer 148 views
148 views
Problem : I am facing following error while importing the Tensorflow. >>> import tensorflow Traceback (most recent call last): File "/home/alecxe/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module> from tensorflow.python. ... soon as I open the terminal windows, and type nvcc -V in the new terminal window it again shows that not installed
asked Dec 7, 2019 alecxe 7.5k points
0 votes
1 answer 587 views
587 views
Problem : I am having following issues in importing tensorflow in python3: >>> import tensorflow as tf Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module> from tensorflow.python. ... I have also installed CUDA 8.0 and cuDNN-v6.0.Also my libcusolver.so.8.0 exists at /usr/local/cuda/lib64/:
asked Nov 24, 2019 alecxe 7.5k points
0 votes
1 answer 2K views
2K views
Problem : The import matplotlib.pyplot as plt is is giving me the error with python2.7, anaconda3. The error shown is as below: ImportError: libGL.so.1: cannot open shared object file: No such file or directory The Detailed Error report is as below : Traceback ... <module> from PyQt5 import QtCore, QtGui, QtWidgets ImportError: libGL.so.1: cannot open shared object file: No such file or directory
asked Dec 18, 2019 alecxe 7.5k points
0 votes
1 answer 810 views
810 views
Problem : While trying to import the OpenCV, using import cv2 I facing the below error: /usr/local/lib/python2.7/dist-packages/cv2/__init__.py in <module>() 12 13 # make IDE's (PyCharm) autocompletion happy ----> 14 from .cv2 import * 15 16 # wildcard import ... - I am trying to play around with the Google's new Colaboratory tool. Please let me know if someone have solution for the above issue.
asked Dec 18, 2019 alecxe 7.5k points
0 votes
1 answer 4 views
4 views
Problem: object_detection/protos/*.proto: no such file or directory
asked Feb 22 Dan phillip 1.9k points