DEV Community

Cover image for Import error: cannot open shared object file:no such file or directory
CoderLegion
CoderLegion

Posted on • Edited on • Originally published at kodblems.com

Import error: cannot open shared object file:no such file or directory

🎉 Before you dive into this article...

🚀 Check out our vibrant new community at CoderLegion.com!

💡 Share your knowledge, connect with like-minded developers, and grow together.

👉 Click here to join now!

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. "Import error: cannot open shared object file:no such file or directory"

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:

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?

Solution :
This error generally occurs when the version of your cuda and tensorflow installed are not compatible. "Import error: cannot open shared object file:no such file or directory"

I also encountered the same Import Error while I was running tensorflow version 1.13.0 with my cuda 9. As I had installed tensorflow on a virtual environment with pip,
I just had to uninstall the tensorflow 1.13.0 and install tensorflow 1.12.0 using following commands :

pip uninstall tensorflow-gpu tensorflow-estimator tensorboard pip install tensorflow-gpu==1.12.0
Now everything is working for me.

OR

You can fix the error by adding the following command to your '.bashrc' file.

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

System configuration:

Ubuntu :- 16.04 LTS Tensorflow :-GPU 2.0beta1 Cuda:- 10.0 cuDNN :-7.6.0 for Cuda 10.0

Here I used the conda to configure my system.

Top comments (0)