I have cuda 8 and libcudnn.so.5 how do I get libcudnn.so6?

I tried installing libcudnn7_7.0.1.13-1+cuda8.0_amd64.deb but don’t see libcudnn.so6 at least under my cuda-8.0/lib64 directory?

The libcudnn.so6 is required for TF 1.3 so I expect a bunch of people will be trying to get this done…


If you want libcudnn.so.6 you should probably install cudnn 6, not 7.


I have downloaded and installed cudnn6 (it seemed to process comp0letely) but still do not see libcudnn.so6 in /usr/local/cuda-8.0 ???

sudo dpkg -i ./libcudnn6_6.0.21-1+cuda8.0_amd64.deb
(Reading database … 617539 files and directories currently installed.)
Preparing to unpack …/libcudnn6_6.0.21-1+cuda8.0_amd64.deb …
Unpacking libcudnn6 (6.0.21-1+cuda8.0) over (6.0.21-1+cuda8.0) …
Setting up libcudnn6 (6.0.21-1+cuda8.0) …
Processing triggers for libc-bin (2.23-0ubuntu9) …
/sbin/ldconfig.real: /usr/lib/nvidia-375/libEGL.so.1 is not a symbolic link

/sbin/ldconfig.real: /usr/lib32/nvidia-375/libEGL.so.1 is not a symbolic link

The file isn’t libcudnn.so6

and it wouldn’t be put in /usr/local/cuda-8.0

If you think the library isn’t installed correctly, please explain exactly what you did to reach that conclusion. If you’re looking for libcudnn.so6 you won’t find it anywhere, ever. And if you’re looking in /usr/local/cuda-8.0 you won’t find it. The file doesn’t go by that name, and it is not installed in that particular directory.

OK my issue is that I have been using Tensorflow 1.2 and it imports successfully and uses libcudnn.so.5 (at least that file is in the above referenced directory)

I have installed the Tensorflow 1.3 rc2 gpu version on Linux 16.04
now running the same code that worked in TF 1.2 in a jupyter notebook in a new environment with TF 1.3 I get:

File “/home/tom/anaconda3/envs/tf3rc/lib/python3.6/imp.py”, line 342, in load_dynamic
return _load(spec)
ImportError: libcudnn.so.6: cannot open shared object file: No such file or directory

So I’m trying to resolve it… one of the notes in the TF3 Release notes that it was built with:

All our prebuilt binaries have been built with cuDNN 6. (https://github.com/tensorflow/tensorflow/releases/tag/v1.3.0-rc2)

So I assumed I needed to update something… But seem to be going down a rabbit hole?

Your libcudnn.so.5 is almost certainly not in /usr/local/cuda-8.0 but is probably in /usr/local/cuda-8.0/lib64

Those are two different directories. If you don’t want to be specific, I can’t help you.

so sorry, my window cut off the /lib64

Still trying to figure out how to install libcudnn.so.6 to solve the TF 1.3 dependency error listed above?


So with some help from an Nvidia friend (Daniel Williams)

We determined that the file was loaded into/as /usr/lib/x86_64-linux-gnu/libcudnn.so.6.0.21 vs where the older libcudnn.so.5 was located /usr/local/cuda-8.0/lib64

Dunno why but There are a number of versions of libcudnn.so located in the lib64 directory

I certainly did no custom installs or rearranging, but rather used deb files as with this update attempt.

In any event:
sudo ln -s /usr/lib/x86_64-linux-gnu/libcudnn.so.6.0.21 ./libcudnn.so.6.0.21
sudo ln -s ./libcudnn.so.6.0.21 ./libcudnn.so.6

Has resolved Tensorflow 1.3 being able to find and execute correctly.

The following seems inconsistent between cudnn versions? (and like I said I just used deb installs(I don’t know any better!)

ls /usr/lib/x86_64-linux-gnu/libcudnn.so.*/usr/lib/x86_64-linux-gnu/libcudnn.so.6

tom@tomServal:~$ ls /usr/local/cuda-8.0/lib64
libcublas_device.a libcusolver_static.a libnppist.so.8.0
libcublas.so libcusparse.so libnppist.so.8.0.27
libcublas.so.8.0 libcusparse.so.8.0 libnppisu.so
libcublas.so.8.0.27 libcusparse.so.8.0.27 libnppisu.so.8.0
libcublas_static.a libcusparse_static.a libnppisu.so.8.0.27
libcudadevrt.a libnppc.so libnppitc.so
libcudart.so libnppc.so.8.0 libnppitc.so.8.0
libcudart.so.8.0 libnppc.so.8.0.27 libnppitc.so.8.0.27
libcudart.so.8.0.27 libnppc_static.a libnpps.so
libcudart_static.a libnppial.so libnpps.so.8.0
libcudnn.so libnppial.so.8.0 libnpps.so.8.0.27
libcudnn.so.5 libnppial.so.8.0.27 libnpps_static.a
libcudnn.so.5.1.5 libnppicc.so libnvblas.so
libcudnn.so.6 libnppicc.so.8.0 libnvblas.so.8.0
libcudnn.so.6.0.21 libnppicc.so.8.0.27 libnvblas.so.8.0.27
libcudnn_static.a libnppicom.so libnvgraph.so
libcufft.so libnppicom.so.8.0 libnvgraph.so.8.0
libcufft.so.8.0 libnppicom.so.8.0.27 libnvgraph.so.8.0.27
libcufft.so.8.0.27 libnppidei.so libnvgraph_static.a
libcufft_static.a libnppidei.so.8.0 libnvrtc-builtins.so
libcufftw.so libnppidei.so.8.0.27 libnvrtc-builtins.so.8.0
libcufftw.so.8.0 libnppif.so libnvrtc-builtins.so.8.0.27
libcufftw.so.8.0.27 libnppif.so.8.0 libnvrtc.so
libcufftw_static.a libnppif.so.8.0.27 libnvrtc.so.8.0
libcuinj64.so libnppig.so libnvrtc.so.8.0.26
libcuinj64.so.8.0 libnppig.so.8.0 libnvToolsExt.so
libcuinj64.so.8.0.27 libnppig.so.8.0.27 libnvToolsExt.so.1
libculibos.a libnppim.so libnvToolsExt.so.1.0.0
libcurand.so libnppim.so.8.0 libOpenCL.so
libcurand.so.8.0 libnppim.so.8.0.27 libOpenCL.so.1
libcurand.so.8.0.27 libnppi.so libOpenCL.so.1.0
libcurand_static.a libnppi.so.8.0 libOpenCL.so.1.0.0
libcusolver.so libnppi.so.8.0.27 stubs
libcusolver.so.8.0 libnppi_static.a
libcusolver.so.8.0.27 libnppist.so

1 Like

I guess it would be nice to know definitively where it should be installed and what is the correct packages to achieve that with?

This is just a workaround. All the TF binaries are built w/ 6, but it works just fine if you link them to the 7 libs.

cd /usr/local/cuda/lib64

greg@salt:/usr/local/cuda/lib64$ ls -l libcudnn*
lrwxrwxrwx 1 root root 37 Aug 22 14:37 libcudnn.so -> /usr/lib/x86_64-linux-gnu/libcudnn.so
lrwxrwxrwx 1 root root 39 Aug 22 14:37 libcudnn.so.7 -> /usr/lib/x86_64-linux-gnu/libcudnn.so.7
lrwxrwxrwx 1 root root 43 Aug 22 14:37 libcudnn.so.7.0.1 -> /usr/lib/x86_64-linux-gnu/libcudnn.so.7.0.1
lrwxrwxrwx 1 root root 43 Aug 22 14:37 libcudnn_static.a -> /usr/lib/x86_64-linux-gnu/libcudnn_static.a
lrwxrwxrwx 1 root root 46 Aug 22 14:37 libcudnn_static_v7.a -> /usr/lib/x86_64-linux-gnu/libcudnn_static_v7.a

greg@salt:/usr/local/cuda/lib64$ sudo ln -s /usr/lib/x86_64-linux-gnu/libcudnn.so libcudnn.so.6
greg@salt:/usr/local/cuda/lib64$ sudo ln -s /usr/lib/x86_64-linux-gnu/libcudnn.so.7.0.1 libcudnn.so.6.0.21

greg@salt:~$ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import tensorflow as tf

This command, however, failed. So I think I’m just going to install the cudnn 6.0 libs.

greg@salt:~/git/tensorflow$ bazel build --config opt \


so means it doesnt supported cudnn 7 if it ask for 6 ?

The current version of Tensorflow and Tensorflow models both build on Ubuntu 17.10 x86_64 and Windows 10 x64 with cudnn 7.0 and cuda 9.0.

The previous version only supposed 6.0/8.0, but it seems the newest versions work now on both platforms.

THANK YOU for revealing the directory /usr/lib/x86_64-linux-gnu as the location of the libcudnn.so files! My installation is CUDA 11.1 with CUDNN 8, on Ubuntu 18.04 OS.

FINALLY my GPU is seen by PyTorch. I had to add that directory into the LD_LIBRARY_PATH in my ~/.bashrc file:
export LD_LIBRARY_PATH=/usr/local/cuda-11.1/lib64:/usr/lib/x86_64-linux-gnu:{LD_LIBRARY_PATH:+:{LD_LIBRARY_PATH}}

Besides that, I had to create a bunch of symbolic links:
/usr/local/cuda-11.1/lib64$ sudo ln -s libcudart.so.11.1.74 libcudart.so.10.1
/usr/local/cuda-11.1/lib64$ sudo ln -s libcublas.so. libcublas.so.10
/usr/local/cuda-11.1/lib64$ sudo ln -s libcusolverMg.so. libcusolver.so.10
/usr/local/cuda-11.1/lib64$ sudo ln -s libcusparse.so. libcusparse.so.10
/usr/lib/x86_64-linux-gnu$ sudo ln -s libcudnn.so.8.0.4 libcudnn.so.7