Junaid Ahmad
Junaid Ahmad

Reputation: 599

ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory

Possible duplicate of this question. I have a gpu account to whom I connect through putty (ssh login). I have created a virtualenv there and I am installing tenorflow through pip for gpu. Everything works fine, when I run command

$ pip list

following list is being shown:

 backports.weakref (1.0rc1)
 bleach (1.5.0)
 funcsigs (1.0.2)
 html5lib (0.9999999)
 Markdown (2.6.8)
 mock (2.0.0)
 numpy (1.13.1)
 olefile (0.44)
 pbr (3.1.1)
 Pillow (4.2.1)
 pip (9.0.1)
 protobuf (3.3.0)
 setuptools (36.0.1)
 six (1.10.0)
 tensorflow-gpu (1.2.1)
 Werkzeug (0.12.2)
 wheel (0.29.0)

But when I run:

$ python
>>> import tensorflow

It shows the following error:

  Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nauman/junaid/final/test/lib/python2.7/site-
  packages/tensorflow/__init__.py", line 24, in <module>
  from tensorflow.python import *
  File "/home/nauman/junaid/final/test/lib/python2.7/site-
  packages/tensorflow/python/__init__.py", line 49, in <module>
  from tensorflow.python import pywrap_tensorflow
  File "/home/nauman/junaid/final/test/lib/python2.7/site-
  packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
  raise ImportError(msg)
  ImportError: Traceback (most recent call last):
  File "/home/nauman/junaid/final/test/lib/python2.7/site-
  packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
  from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/nauman/junaid/final/test/lib/python2.7/site-
  packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in 
  <module>
  _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/nauman/junaid/final/test/lib/python2.7/site-
  packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in 
  swig_import_helper
  _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, 
  description)
  ImportError: libcusolver.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.

I have also set my environment variables like this:

  export CUDA_HOME=/opt/cuda
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$CUDA_HOME/lib64:$CUDA_HOME/extras/CUPTI/lib64"

Moreover, I found that libcusolver.so.8.0 is not there, while libcusolver.so.7.5 is there in cuda/lib64/. Somehow tensorflow is finding wrong file or I ain't know nothing. Any help would be appreciated as I am new to all this stuff. Python version: 2.7 OS: Linux

Upvotes: 3

Views: 12590

Answers (4)

Aizaz Sharif
Aizaz Sharif

Reputation: 73

This may be connected to the incorrect linking of your libraries.
Simply run sudo ldconfig /usr/local/cuda/lib64. It solved for me.

If you need to know more: ldconfig man page.

Upvotes: 5

markroxor
markroxor

Reputation: 6496

If you are using cuda-9.0 try sudo apt install nvidia-cuda-dev (if you are using an Ubuntu distribution)

Upvotes: 0

era_misa
era_misa

Reputation: 200

If you installed tensorflow-gpu by using pip with prebuilt .whl, the cuda version were fixed. As far as I know, starting 0.11.0rc1, all the prebuilt packages are now built for cuda 8. So there are two ways to solve the problem:

  1. install cuda 8 for the prebuilt packages tensorflow-gpu >= 0.11.orc1
  2. keep cuda 7.5 stay, then build tensorflow-gpu from source code

Upvotes: 0

Junaid Ahmad
Junaid Ahmad

Reputation: 599

I solved the issue. Actually I have cuda 7.5 installed and I was installing latest tensorflow version which probably support cuda 8.0. So I downgraded.

 pip install --upgrade \ https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl

Upvotes: 3

Related Questions