TensorFlow: libcudart.so.7.5: cannot open shared object file: No such file or directory

匿名 (未验证) 提交于 2019-12-03 01:48:02

问题:

I am running TensorFlow on Ubuntu 15.10. When I enter pip show tensorflow, I see that TF has been installed properly.

However, when I write import tensorflow as tf, I get the following error message:

Traceback (most recent call last):   File "", line 1, in    File "/home/me/anaconda2/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in      from tensorflow.python import *   File "/home/me/anaconda2/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in      from tensorflow import contrib   File "/home/me/anaconda2/lib/python2.7/site-packages/tensorflow/contrib/__init__.py", line 23, in      from tensorflow.contrib import layers   File "/home/me/anaconda2/lib/python2.7/site-packages/tensorflow/contrib/layers/__init__.py", line 68, in      from tensorflow.contrib.layers.python.layers import *   File "/home/me/anaconda2/lib/python2.7/site-packages/tensorflow/contrib/layers/python/layers/__init__.py", line 22, in      from tensorflow.contrib.layers.python.layers.initializers import *   File "/home/me/anaconda2/lib/python2.7/site-packages/tensorflow/contrib/layers/python/layers/initializers.py", line 24, in      from tensorflow.python.ops import random_ops   File "/home/me/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/random_ops.py", line 23, in      from tensorflow.python.framework import ops   File "/home/me/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 39, in      from tensorflow.python.framework import versions   File "/home/me/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/versions.py", line 22, in      from tensorflow.python import pywrap_tensorflow   File "/home/me/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in      _pywrap_tensorflow = swig_import_helper()   File "/home/me/anaconda2/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.7.5: cannot open shared object file: No such file or directory 

For what it's worth, I have followed the instructions here and set my LD_LIBRARY_PATH and CUDA_HOME environment variables.

Any advice?

EDIT:

I have installed CUDA 7.5 and added these to my .profile file:

export LD_LIBRARY_PATH="/usr/local/cuda-7.5/lib64" export CUDA_HOME=/usr/local/cuda-7.5 

However, I continue to see the same error message.

EDIT:

I see the following output when I run ldd /usr/local/cuda-7.5/lib64/libcudart.so.7.5:

linux-vdso.so.1 =>  (0x00007ffdac7ea000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc27a281000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc27a07d000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc279e5e000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fc279c56000) /lib64/ld-linux-x86-64.so.2 (0x00005604f5406000) 

EDIT:

If it is relevant, I use GeForce GT640.

EDIT:

I followed @tommus' advice and called source ~/.profile before running TensorFlow, and now it works like a charm.

Thanks to everyone who tried to help me in the comments -- this is my first experience with any kind of Linux distribution, and I am really very appreciative of all the patient assistance I have received so far :-) You guys are absolutely awesome!

回答1:

After editing .profile file you either need to log out and log back in or run the following command:

source ~/.profile

The solution is persistent so there is no need to perform it ever again.



回答2:

sudo nano /etc/ld.so.conf.d/nvidia.conf

Add this:

/usr/local/cuda-8.0/lib64

/usr/local/cuda-8.0/lib

run

sudo ldconfig

if it works well ,please tell me.



回答3:

If you are using pip but other answers did not work for you, try this.

In my case this exact problem was solved by reinstalling tensorflow using:

pip install tensorflow 

Pip must have messed up its dependencies or something when installing other packages after Tensorflow installation (I've run pip install -r requirements.txt afterwards for my own purposes --> that broke Tensorflow).



回答4:

You maybe need to update your cuDNN version as Tensorflow 1.3 doesn't work with cuDNN 5.1 or earlier. Download cuDNN 6.0 or upper and install to fix the issue



回答5:

It's due to CUDA. Install CUDA8 from this link https://developer.nvidia.com/cuda-downloads And , you're good to go!



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!