0
votes

Trying to install tensorflow-gpu with cuDNN/CUDA for NVIDIA Tesla K80 on us-central1-w on Ubuntu 16.04 with 25 gb of disk space. Any idea why I'm getting the below error ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory, when trying to launch the GPU in Python 2.7? What code will fix this? Is there an easier workaround?

Download CUDA

sudo su

curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
dpkg -i ./cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
apt-get update
apt-get -y install cuda-8.0
nvidia-smi -pm 1 
nvidia-smi

Install cuDNN v6.0

CUDNN_TAR_FILE="cudnn-8.0-linux-x64-v6.0.tgz"
wget http://developer.download.nvidia.com/compute/redist/cudnn/v6.0/${CUDNN_TAR_FILE}
tar -xzvf ${CUDNN_TAR_FILE}
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/lib64/libcudnn*

Export Paths

echo 'export CUDA_HOME=/usr/local/cuda' >> ~/.bashrc
echo 'export PATH=$PATH:$CUDA_HOME/bin' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=$CUDA_HOME/lib64' >> ~/.bashrc
source ~/.bashrc

Install Python 2.7 support for Tensorflow w/GPUs

sudo apt-get -y install python-dev
sudo apt-get -y install python-pip 
sudo pip install --upgrade pip
sudo apt-get -y install libcupti-dev 
sudo -H pip install tensorflow-gpu
sudo -H pip install --upgrade tensorflow-gpu

python # Launch Python

From Python >>> prompt, run:

import tensorflow as tf

Error output in Python:

>>> import tensorflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 49, in <modu
le>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74,
 in <module>
    raise ImportError(msg)
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py",    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

References:

Gist Startup Script https://gist.github.com/mjdietzx/0ff77af5ae60622ce6ed8c4d9b419f45

Using a GPU & TensorFlow on Google Cloud Platform https://medium.com/google-cloud/using-a-gpu-tensorflow-on-google-cloud-platform-1a2458f42b0

1

1 Answers

1
votes

The Tensorflow Linux version has now moved to CUDA 9.0. You either need to install an older version or use CUDA 9+

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

If you are installing TensorFlow with GPU support using one of the mechanisms described in this guide, then the following NVIDIA software must be installed on your system:

CUDA® Toolkit 9.0. For details, see NVIDIA's documentation. Ensure that you append the relevant Cuda pathnames to the LD_LIBRARY_PATH environment variable as described in the NVIDIA documentation.

The NVIDIA drivers associated with CUDA Toolkit 9.0. cuDNN v7.0. For details, see NVIDIA's documentation. Ensure that you create the CUDA_HOME environment variable as described in the NVIDIA documentation.