tensorflow: ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory
I have installed cuda 7.5, not 8, but when I get this error when I try to import tensflow (having installed ts binaries for 7.5, gpu, linux). I have tried un- and re-installing everything repeatedly. I may have at one time attempted to install cuda 8 in the past, but 7.5 is in my $path.
the complete error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/usr/local/lib/python2.7/dist-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
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 36 (8 by maintainers)
Double check that you have exported the LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64
Was fighting this issue too and that solved it for me. Existed and everything lol
For me, the only thing that works is to type sudo ldconfig /usr/local/cuda/lib64
Correct, starting 0.11.0rc1, all our prebuilt packages are now built for cuda8. With cuda7.5, you either need to install the 0.11.0rc0 wheel file, or build from sources.
sudo ldconfig /usr/local/cuda/lib64 works for me.
@maxss280 Works!
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64
orexport LD_LIBRARY_PATH=/usr/local/cuda/lib64
sudo ldconfig /usr/local/cuda/lib64
works for me also, but i need to do it once in a while (no matter if i restart or not). weird !!Perhaps you need to make a symbolic link from
/usr/local/cuda
to/usr/local/cuda-8.0
? That seemed to fix the issue for mesudo ldconfig /usr/local/cuda/lib64 works for me as well, but i have to do it EVERY time i’ve restarted my computer… Any tips how to avoid this?
Sorry, I forgot to come back here, the problem was that I forgot to export the path to cuda lib, here is the solution:
http://askubuntu.com/questions/889015/cant-install-cuda-8-but-have-correct-nvidia-driver-ubuntu-16
@silentsnooc, you probably should open a new issue with full context of your install environment ( we have an issue template). However, here is generic information:
dpkg -L <package>
will list files installed by installing a deb. You can also usefind
orlocate
to find the file if that doesn’t help.If you can’t find libcudart.so.8.0, install CUDA properly (possibly manually). If you cannot run NVidia CUDA demos, CUDA is not installed properly. Sometimes it is better to use the NVidia shell script install method rather than a debian package to install both the NVidia driver and the CUDA toolkit. I find that works more reliably. However, if you do this, you must be careful to remove all .deb related cuda information. I’d suggest finding a good tutorial online on installing NVidia kernel drivers and cuda toolkit and following them.
Try TensorFlow. If it can’t find find libcudart.so.8.0, add the directory that contains it to LD_LIBRARY_PATH environment variable.
Your issue is likely a generic CUDA installation issue rather than a TensorFlow specific problem. Installing nvidia drivers and cuda on Linux is harder than one would like. Sometimes it goes smoothly, but often it does not.
Thanks!
There is very little information here. Could you create a new issue, filling in all the fields required by the template?
Hello,
I had the same issue. I fixed it by adding the below command to the ‘.bashrc’ file.
System configuration:
I used conda to configure my system.
On my computer I had :
When importing tensorflow, I had the same error ImportError:
and even
To overcome the second issue I installed
tensorflow 1.4
instead of 1.6 and for the first I did $ export PATH=“$PATH:/usr/local/cuda-8.0/bin” $ export LD_LIBRARY_PATH=“/usr/local/cuda-8.0/lib64”But then I had another issue :
This was because I had cudnn5.1 as required but actually it needs cudnn6
Here are the steps to uninstall cudnn5.1 and install cudnn6:
1- Uninstall cudnn 5.1 rm -f /usr/include/cudnn.h rm -f /usr/lib/x86_64-linux-gnu/libcudnn rm -f /usr/local/cuda-/lib64/libcudnn
2- Install cudnn6
After having subscribed to nvdia, go to here https://developer.nvidia.com/rdp/cudnn-download and download cudnn6 for cuda8 and then go to the folder where you downloaded the cudnn and do :
Now you should have tensorflow
Try it on typing in the console:
If you want to work in anaconda and the error persists , try :
then you can find the name of the directory where you have your config file (Ill call it
) and open /jupyter_notebook_config.py and add at the top :
Now it should work…
Here are the websites that helped me:
https://askubuntu.com/questions/952075/how-to-upgrade-tensorflow-to-v1-3-cudnn-cuda-upgrade https://developer.nvidia.com/rdp/cudnn-download https://medium.com/@ikekramer/installing-cuda-8-0-and-cudnn-5-1-on-ubuntu-16-04-6b9f284f6e77 https://stackoverflow.com/questions/43984135/tensorflow-gpu-can-not-be-called-from-jupyterhub-jupyter-notebook-why
Traceback (most recent call last): File “evaluate.py”, line 3, in <module> import transform, numpy as np, vgg, pdb, os File “src/transform.py”, line 1, in <module> import tensorflow as tf, pdb File “/home/prateek/.local/lib/python2.7/site-packages/tensorflow/init.py”, line 24, in <module> from tensorflow.python import * File “/home/prateek/.local/lib/python2.7/site-packages/tensorflow/python/init.py”, line 60, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File “/home/prateek/.local/lib/python2.7/site-packages/tensorflow/python/init.py”, line 49, in <module> from tensorflow.python import pywrap_tensorflow File “/home/prateek/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py”, line 28, in <module> _pywrap_tensorflow = swig_import_helper() File “/home/prateek/.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
Error importing tensorflow. Unless you are using bazel, you should not try to import tensorflow from its source directory; please exit the tensorflow source tree, and relaunch your python interpreter from there.
I am using jupyter notebook to use keras which has tensorflow as backend. I have
libcudart.so.8.0
inusr/local/cuda-8.0/
as showed by below:but still, when the import part of keras run, I got
Could anyone help?
What exact binary (url, whl file) did you install? Many (all @gunan?) new binaries will be Cuda 8.0 only. What you are seeing indicates that you downloaded a cuda 8 binary.