I am getting this error when I want to import tensorflow-gpu on Ubuntu 16.04.

I have installed CUDA 9.1 properly, cudNN 7.1 properly and tested both without facing any problem. (using python 3.5 2.)

I have used pip3 in either ways (with several tensorflow versions): i tried:

#for tensoflow 1.4
pip3 install tensorflow-gpu==1.4
# for tensorflow 1.8 from source
pip3 install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.8.0rc1-cp35-cp35m-linux_x86_64.whl

I have tried to install several versions of tensorflow-gpu , 1.4, 1.5 , 1.8 ,1.9. still getting the same error, when running

import tensorflow as tf 

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

Is there any way to get rid of this? or it is just installing cuda 9.0 ( which will be the pain as it took a week for me to install the cuda 9.1 due to problems of nvidia and Ubuntu !)

I also installed libcupti (required) and Bazel (required). from this page: http://www.python36.com/install-tensorflow141-gpu/2/

moreover, i have installed the same setup on windows (tensorflow 1.8 , cuda 9.1) without any problem.

  • Hello Omid, and welcome to Ask Ubuntu. In order to increase that chances that somebody gives a good answer to your question, the first thing to do is ask a question; you should edit your post and actually include a question. You should also clarify the context: who gives that error message? When does it give that error message? What are you doing in order to make that error message appear? Is the error message unexpected? If so, what were you expecting to happen? – abu_bua Aug 10 at 10:29
  • you should enclose the commands you used. – abu_bua Aug 10 at 10:37
  • i tried: pip3 install tensorflow-gpu==1.4 pip3 install --ignore-installed --upgrade storage.googleapis.com/tensorflow/linux/gpu/… – Omid Aug 10 at 10:38
  • libcublas9.1 is in the 18.04 repositories and you have CUDA 9.1 installed so why don't you manually download libcublas9.1 and double-click it to open it for installation in Ubuntu Software. – karel Aug 10 at 10:39
  • 1
    @Omid Have you uninstalled the previous CUDA version before trying to install the new one? – avazula Aug 10 at 10:50

You're trying to build tensorflow-gpu 1.4, which is too old to be compatible with CUDA 9.1.

From here you have three options:

  1. You can try to create a symbolic link to force the system to use CUDA 9.1, though it's not sure it'll succeed

  2. You can follow this tutorial which explains how to easily install CUDA 9.0 on Ubuntu 16.04.

  3. If it still doesn't work and that you really want to try to install Tensorflow with CUDA 9.1, you can try to install CUDA, CUDNN and NCCL sources from the NVIDIA site, and then emulate the way these packages would have been installed from ppa.

Once you've downloaded the tar packages, type the following to configure CUDA:

sudo mkdir -p /usr/local/cuda /usr/local/cuda/extras/CUPTI /usr/local/cuda/nvvm
sudo ln -s /usr/bin /usr/local/cuda/bin
sudo ln -s /usr/include /usr/local/cuda/include
sudo ln -s /usr/lib/x86_64-linux-gnu /usr/local/cuda/lib64
sudo ln -s /usr/local/cuda/lib64 /usr/local/cuda/lib
sudo ln -s /usr/include /usr/local/cuda/extras/CUPTI/include
sudo ln -s /usr/lib/x86_64-linux-gnu /usr/local/cuda/extras/CUPTI/lib64
sudo ln -s /usr/lib/nvidia-cuda-toolkit/libdevice /usr/local/cuda/nvvm/libdevice

Then you can either download cuDNN and NCCL from source and configure them in the same fashion as above (this article here explains how to do so), or download their .deb package and see if the installation works now. If it doesn't, then try to install from source.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.