Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am trying to use tensorflow-gpu on my system. I have re-installed it many times, it gives the error give below. But when I use tensorflow-cpu it works fine. I have cuda 8.0 toolkit installed and cudnn 5.1.

  Traceback (most recent call last):
  File "finetune.py", line 17, in <module>
    import tensorflow as tf
  File "/home/saurabh/code/env/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/home/saurabh/code/env/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 72, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/saurabh/code/env/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 61, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/saurabh/code/env/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/home/saurabh/code/env/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory


Failed to load the native TensorFlow runtime.

See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
like image 282
talos1904 Avatar asked Apr 01 '17 22:04

talos1904


3 Answers

If changing your path variable does not work, running the following in your terminal is what usually solves this for me:

sudo ldconfig /usr/local/cuda/lib64

(sometimes cuda may need to be something like cuda-8.0, depending on your installation)

like image 79
Michele Tonutti Avatar answered Nov 10 '22 10:11

Michele Tonutti


The problem is that you don't have environment variable CUDA_HOME set. If you think you have CUDA installed, then you need to make sure that the above environment variable is set prob=perly and contains address of the CUDA installation directory where all share libraries are located.

export CUDA_HOME=/CUDA/installation/path
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$CUDA_HOME/lib64:$CUDA_HOME/extras/CUPTI/lib64"
like image 21
Ali Avatar answered Nov 10 '22 11:11

Ali


sudo ldconfig /usr/local/cuda/lib64

Works for me.

Please refer this link for more information. https://github.com/tensorflow/tensorflow/issues/5343

like image 1
Luna Kong Avatar answered Nov 10 '22 10:11

Luna Kong