libcublas.so.8.0 error with tensorflow

2020-02-09 02:56发布

I am currently trying to run a project from GitHub: https://github.com/nilboy/pixel-recursive-super-resolution

After installing ubuntu on VM, I installed python with tensorflow 2.7 using the pip command.

When I try to run the training session with python I get this error:

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

I could't find anything exactly the same, only this error: ImportError: libcudart.so.8.0: cannot open shared object file

I am using Yoga 13, so I don't have an NVIDIA GPU and I am trying to run this project on the CPU. Can you help identify the tensorflow problem?

Source: https://www.tensorflow.org/install/install_linux

6条回答
【Aperson】
2楼-- · 2020-02-09 03:09

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?

查看更多
在下西门庆
3楼-- · 2020-02-09 03:13

I got the same error while running Tensorflow with GPU support in Python and solved it like this:

$ export PATH="$PATH:/usr/local/cuda-8.0/bin" 
$ export LD_LIBRARY_PATH="/usr/local/cuda-8.0/lib64"

For enabling all users you may have to enter these export statements in etc/environments in Ubuntu

查看更多
Summer. ? 凉城
4楼-- · 2020-02-09 03:14

It may be an issue with the CUDA version installed. try
$ sudo apt-get install cuda-8-0

查看更多
▲ chillily
5楼-- · 2020-02-09 03:16

You need to install Cuda 8.0 and configure the environment as below:

export PATH="$PATH:/usr/local/cuda-8.0/bin"
export LD_LIBRARY_PATH="/usr/local/cuda-8.0/lib64"
查看更多
放荡不羁爱自由
6楼-- · 2020-02-09 03:30

may be preinstalled tensorflow-gpu, so

pip3 install tensorflow --ignore-installed

as this helped me from stackoverflow

查看更多
倾城 Initia
7楼-- · 2020-02-09 03:30

Tensroflow/Keras requirements

In my opinion the tricky steps are installing Nvidia drivers and Cuda-8. If you follow the instructions you're gonna have a bad time. Instead install it thru apt:

sudo apt-get install nvidia-384 #can type nvidia then hit "tab" to view all available options
sudo apt-get install cuda-8-0

If that doesn't work...good luck. You can try this:

Check that you do not have cuda-9: ls /usr/local

Install Cuda 8.0.

Reboot

Run export LD_LIBRARY_PATH=/usr/local/cuda-8.0/extras/CUPTI/lib64:$LD_LIBRARY_PATH but replace /usr/local/cuda-8.0/extras/CUPTI/lib64 with the relevant output from echo $LD_LIBRARY_PATH

Check that it worked nvcc --version prints out CUDA version

查看更多
登录 后发表回答