Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensorflow- ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory

I'm trying to run Tensorflow-gpu.

I installed Cuda-9.0 and cuDNN v7.0.3. I tested both(as said in their guides) and they were working fine.

Then I installed Tensorflow-gpu using pip3(I use python3) and it gave me this error upon import:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.5/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.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: libcublas.so.8.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.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 72, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.5/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.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

There are some similar questions I found, but all are for some or the other previous version of Cuda (mostly 8.0) and I'm not sure whether they'll work. I also tried some of them, like setting the LD_LIBRARY_PATH but nothing worked. I also tried the link in the error itself but that is also a solution for cuda 8.0

like image 395
Abhor Avatar asked Nov 13 '17 18:11

Abhor


2 Answers

Currently, the binary installable versions of TF-GPU require CUDA 8. This will probably change in the future, but for those binaries, you can't satisfy the requirement with CUDA 9.

If you really want to use CUDA 9/CUDNN 7, you will need to build TF from sources. Otherwise install CUDA 8 and point TF at that. CUDA 8 can be installed alongside CUDA 9 and you don't need to modify the driver; the CUDA 9 GPU driver will work with CUDA 8 install.

You can see more details in the answer here: https://devtalk.nvidia.com/default/topic/1026198/cuda-9-0-importerror-libcublas-so-8-0/

I hope this helps :D

like image 118
Amr Awad Avatar answered Oct 13 '22 00:10

Amr Awad


the newest tf 1.5 release support cudnn7 and cuda9 now , and through pip3 you now can have the 1.5 version installed, however I still have problem with cuda and tensorflow using docker container

like image 25
Zaikun Xu Avatar answered Oct 12 '22 23:10

Zaikun Xu