ImportError: libcublas.so.9.0: cannot open shared objects file

I currently have cuda 8.0 and cuda 9.0 installed in the Gpu support system. I encountered this error when importing from the keras module. He says that he failed to load his own tensorflow workspace. The error log I received was:

Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.5/dist-
packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)

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

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "Try1.py", line 11, in <module>
from keras.models import Sequential
File "/usr/local/lib/python3.5/dist-packages/Keras-2.0.9-py3.5.egg/keras/__init__.py", line 3, in <module>
File "/usr/local/lib/python3.5/dist-packages/Keras-2.0.9-py3.5.egg/keras/utils/__init__.py", line 6, in <module>
File "/usr/local/lib/python3.5/dist-packages/Keras-2.0.9-py3.5.egg/keras/utils/conv_utils.py", line 3, in <module>
File "/usr/local/lib/python3.5/dist-packages/Keras-2.0.9-py3.5.egg/keras/backend/__init__.py", line 83, in <module>
File "/usr/local/lib/python3.5/dist-packages/Keras-2.0.9-py3.5.egg/keras/backend/tensorflow_backend.py", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 73, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory


Failed to load the native TensorFlow runtime.

When I run nvcc -version, the cuda version is returned,

Cuda compilation tools, release 8.0, V8.0.61

I read about some similar post, but could not solve my problem. Basically, I think this is a clash between two versions of cuda. Can someone tell me how to solve this? Thanks in advance.

+34
source share
10 answers

LD_LIBRARY_PATH, /usr/local/cuda-9.0/lib64 /usr/local/cuda-9.0/lib64. .bashrc ( )

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64/
+35

 pip3 install --upgrade tensorflow-gpu==1.4

pip3 install --upgrade tensorflow-gpu==1.4 , tenorflow 1.4.0. , 1.6.0.

+4

Tensorflow Cuda 9.1 . , Tensorflow .

, Cuda 9.1 + cuDNN 6 Tensorflow, , .

https://devtalk.nvidia.com/default/topic/1026198/cuda-setup-and-installation/cuda-9-0-importerror-libcublas-so-8-0

, :

  1. CUDA 8.0 + Tensorflow - CUDA, Tensorflow.

  2. CUDA 9.0 + Tensorflow - CUDA, Tensorflow.

+4

Tensorflow> = 1.5 CUDA> 8.0. , CUDA 8.0, tenorflow 1.4.

pip install tensorflow-gpu==1.4

+1

Google protobuf-, - , , libcublas.so.9.0.

protobuf (3.5.0) . protobuf apt install protobuf-compiler Ubuntu 16.04. , Python pip3 protobuf. CUDA 9.0, 9.1 tenorflow.

protobuf, protoc --version, 2.6.1 16.04. Python Protoc - 3.5.2.post1. . tenorflow CUDA 8, . , tenensflow 1.8.0 .

0

, , , , . , , (). , , .

, - .

0

, cuda, , , , .

gedit ~/.bashrc

, CUDA , .

:

export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:/usr/lib/nvidia-384

cuda, nvidia, :

export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:/usr/lib/nvidia-390

, :)

0

Ubuntu 16.04 18.04. CUDA 9.1 Tensorflow 1.12.0, Tensorflow CUDA 9.0. CUDA 9.0, .

, CUDA. , , , --silent --toolkit --override, LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64. /usr/local/cuda /usr/local/cuda-9.1, , .

Tensorflow .

0

I tried to install tf in Anaconda environment and I was having the same problem. After installing CUDA and cuDNN, I had to first create a new environment, and then in this envpip install tensorflow-gpu

0
source

I solved the following steps:

# Add NVIDIA package repository
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
sudo apt install ./cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb
sudo apt install ./nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb
sudo apt update

# Install CUDA and tools. Include optional NCCL 2.x
sudo apt install cuda9.0 cuda-cublas-9-0 cuda-cufft-9-0 cuda-curand-9-0 \
    cuda-cusolver-9-0 cuda-cusparse-9-0 libcudnn7=7.2.1.38-1+cuda9.0 \
    libnccl2=2.2.13-1+cuda9.0 cuda-command-line-tools-9-0

# Optional: Install the TensorRT runtime (must be after CUDA install)
sudo apt update
sudo apt install libnvinfer4=4.1.2-1+cuda9.0
0
source

Source: https://habr.com/ru/post/1692652/


All Articles