Upgrading Tensorflow to 1.3.0 and cuDNN

1.5k views Asked by At

I upgraded my TensorFlow 1.0.1 with

$ pip install --upgrade tensorflow-gpu

on Ubuntu 16.04, cuDNN 5.1.5 and CUDA 8.0

However, there's error message when I import tensorflow in python module as below:

>> import tensorflow as tf
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 <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    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: libcudnn.so.6: cannot open shared object file: No such file or directory

Failed to load the native TensorFlow runtime.

I think this is the problem with cuDNN version compatibility. Anyone knows how to upgrade cuDNN and make compatible with tensorflow 1.3.0??

2

There are 2 answers

0
mrry On

TensorFlow 1.3 requires cuDNN version 6. Follow the installation instructions for your platform on NVIDIA's cuDNN website. Once cuDNN 6 is installed successfully, your installation of TensorFlow 1.3 should start working.

0
dnzzcn On

I wrote a script which can be used to upgrade the cuDNN version with a clean install. You can download the script from:

https://github.com/dnzzcn/cuDNNv

This is what the script does:

#!/bin/bash

rm -f /usr/include/cudnn.h
rm -f /usr/lib/x86_64-linux-gnu/*libcudnn*
rm -f /usr/local/cuda-*/lib64/*libcudnn*


cp -P packages/cudnn/include/cudnn.h /usr/include
cp -P packages/cudnn/lib64/libcudnn* /usr/lib/x86_64-linux-gnu/
chmod a+r /usr/lib/x86_64-linux-gnu/libcudnn*

rm -rf packages/cudnn

It performs the installation operations automatically for the version you need.

If you have TensorFlow 1.3.0, which requires cuDNN v6.0, installing cuDNN v6.0 by using the script will be sufficient.