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

2 1

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.

Image of Stellar post

Check out Episode 1: How a Hackathon Project Became a Web3 Startup πŸš€

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

Top comments (0)

πŸ‘‹ Kindness is contagious

Dive into this informative piece, backed by our vibrant DEV Community

Whether you’re a novice or a pro, your perspective enriches our collective insight.

A simple β€œthank you” can lift someone’s spiritsβ€”share your gratitude in the comments!

On DEV, the power of shared knowledge paves a smoother path and tightens our community ties. Found value here? A quick thanks to the author makes a big impact.

Okay