On my computer I had :
cudnn5.1,
cuda8.0
When importing tensorflow, I had the same error ImportError:
libcublas.so.8.0: cannot open shared object file: No such file or
directory
and even
libcublas.so.9.0: cannot open shared object file: No such file or
directory
To overcome this issue I installed tensorflow 1.4
instead of 1.6
and did what Umair Qadir suggested.
But then I had another issue :
libcudnn.so.6: cannot open shared object file: No such file or
directory
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 :
$ tar xvzf cudnn-8.0-linux-x64-v5.1-ga.tgz
$ sudo cp -P cuda/include/cudnn.h /usr/local/cuda/include
$ sudo cp -P cuda/lib64/libcudnn /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h
/usr/local/cuda/lib64/libcudnn*
Now you should have tensorflow
Try it on typing in the console:
$python
import tensorflow
If you want to work in anaconda and the error persists , try :
$jupyter notebook --generate-config
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 :
import os
c = get_config()
os.environ['LD_LIBRARY_PATH'] = '/usr/local/cuda-8.0/lib64:usr/local/cuda-8.0/lib64/libcudart.so.8.0'
c.Spawner.env.update('LD_LIBRARY_PATH')
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
tensorflow gpu can not be called from jupyterhub/jupyter notebook, why?