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

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 16.04.6 LTS
  • TensorFlow installed from (source or binary): Binary (pip3 install -U tensorflow-gpu
  • TensorFlow version: current version from pip (maybe version 1.13.1)
  • Python version: Python 3.5.2
  • Installed using virtualenv? pip? conda?: virtualenv environment with pip
  • CUDA/cuDNN version: Cuda 9.0
  • GPU model and memory: Titan Xp

Describe the problem I tried to install tensorflow-gpu follow the instruction at link and pip install -U tensorflow gpu. But when I check it import tensorflow as tf appear a bug as follow:

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

Meanwhile, I also tried installing pytorch and succeeded. (Figure below) screenshot from 2019-02-28 20-31-09

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 37 (1 by maintainers)

Most upvoted comments

how did you solve it?

Yes, I figured out my system installed Cuda 9.0 but maybe tensorflow 1.13.1 only support Cuda 10. So I installed tensorflow 1.12.0 and it works!

Thanks!

how did you solve it ?

I have TensorFlow 1.13.1 working on Ubunutu 16.04 with Python 3.7.2. I had the error above using CUDA 10.1, but it went away after downgrading to CUDA 10.0

We need to wait until tensorflow providing support to CUDA10.1.

I solved the problem with missing libraries in tensorflow-gpu by creating these 7 links:

sudo ln -s /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudart.so.10.2.89 /usr/local/cuda/lib64/libcudart.so.10.0 sudo ln -s /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn.so.7.6.5 /usr/local/cuda/lib64/libcudnn.so.7 sudo ln -s /usr/lib/x86_64-linux-gnu/libcublas.so.10.2.2.89 /usr/local/cuda/lib64/libcublas.so.10.0 sudo ln -s /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcufft.so.10.1.2.89 /usr/local/cuda/lib64/libcufft.so.10.0 sudo ln -s /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcurand.so.10.1.2.89 /usr/local/cuda/lib64/libcurand.so.10.0 sudo ln -s /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcusolver.so.10.3.0.89 /usr/local/cuda/lib64/libcusolver.so.10.0 sudo ln -s /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcusparse.so.10.3.1.89 /usr/local/cuda/lib64/libcusparse.so.10.0

Without downgrade any chance ?

Hello,

I had the same issue. I fixed it by adding the below command to the ‘.bashrc’ file.

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

System configuration:

Ubuntu 16.04 LTS
Cuda 10.0
cuDNN 7.6.0 for Cuda 10.0

I used conda to configure my system.

I had the same problem with tf 1.14 on Ubuntu 19.10 with Cuda 10.1

print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))

If it reports 0 GPUs, it should list libraries that it can’t find. I got it working by creating symlinks from the 10.1 libraries to the 10.0 names that TensorFlow reported was missing

sudo ln -s /usr/lib/x86_64-linux-gnu/libcusparse.so.10.1.168 /usr/lib/x86_64-linux-gnu/libcusparse.so.10.0

You’ll need to do a find to locate the library locations and there will likely be 5-10 libraries listed that you’ll need to do this for.

using tensorflow 1.12, it is working.

I have TensorFlow 1.13.1 working on Ubunutu 16.04 with Python 3.7.2. I had the error above using CUDA 10.1, but it went away after downgrading to CUDA 10.0

Same here on CentOS 7, TF 1.13.1 would not import with latest CUDA (10.1) but worked fine after downgrade to CUDA 10.0. Thanks for the tip.

Can you explain how to easily downgrade from cuda 10.1->10.0? Do you also have to change the Cudnn libraries?

I have TensorFlow 1.13.1 working on Ubunutu 16.04 with Python 3.7.2. I had the error above using CUDA 10.1, but it went away after downgrading to CUDA 10.0

How do you go about downgrading CUDA from 10.1 -> 10.0? Running arch btw

how did you solve it?

Yes, I figured out my system installed Cuda 9.0 but maybe tensorflow 1.13.1 only support Cuda 10. So I installed tensorflow 1.12.0 and it works!

Thanks!

Thanks! It was really helpful to me. I have been suffering this problem for 1 month and cant figure out how to fix this until i see your comment! ❤️ You are so smart ❤️

On ubuntu 18.10 - I successfully installed CUDA 10.0 toolkit by downgrading gcc and g++ version to 7.3. Now I can see my nvcc --version is 10.0 .

But still I getting that common errors… libcublas.so.10.0 is missing

Any IDEA ? Now what’s a issue !


shivangpatel@shivangpatel:~$ python3 -c 'import tensorflow as tf; print(tf.__version__)'  # for Python 3
Traceback (most recent call last):
  File "/home/shivangpatel/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/shivangpatel/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/shivangpatel/.local/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 "/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 "<string>", line 1, in <module>
  File "/home/shivangpatel/.local/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/home/shivangpatel/.local/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/shivangpatel/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/shivangpatel/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/shivangpatel/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/shivangpatel/.local/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 "/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.

if you are using conda

conda install cudatoolkit cudnn

no need to install cuda.

Recently I reinstalled ubuntu then have this problem. I searched for libcublas.so.10.0 on pc, only found it under conda floader., maybe I should install cuda by deb.

tensorflow-gpu=1.13.1 python=3.7.3 conda 4.6.14

Can you explain how to easily downgrade from cuda 10.1->10.0? Do you also have to change the Cudnn libraries?

you can do that with this command. sudo apt purge cuda sudo apt autoremove sudo apt install cuda-10-0

And now it is working.

just had the same issue on Debian