How can I install CuDNN on Ubuntu 16.04?

Step 0: Install cuda from the standard repositories. (See How can I install CUDA on Ubuntu 16.04?)

Step 1: Register an nvidia developer account and download cudnn here (about 80 MB)

Step 2: Check where your cuda installation is. For the installation from the repository it is /usr/lib/... and /usr/include. Otherwise, it will be /usr/local/cuda/ or /usr/local/cuda-<version>. You can check it with which nvcc or ldconfig -p | grep cuda

Step 3: Copy the files:

Repository installation:

$ cd folder/extracted/contents
$ sudo cp -P include/cudnn.h /usr/include
$ sudo cp -P lib64/libcudnn* /usr/lib/x86_64-linux-gnu/
$ sudo chmod a+r /usr/lib/x86_64-linux-gnu/libcudnn*

Runfile installation:

$ cd folder/extracted/contents
$ sudo cp include/cudnn.h /usr/local/cuda/include
$ sudo cp lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

From 5.1 onwards you can't install according to what @Martin mentioned. Download libcudnn6_6.0.21-1+cuda8.0_amd64.deb, libcudnn6-dev_6.0.21-1+cuda8.0_amd64.deb, libcudnn6-doc_6.0.21-1+cuda8.0_amd64.deb from nvidia site and install one by one follwing way.

 sudo dpkg -i <library_name>.deb

Edit: You must first install runtime (libcudnn6_6.0.21-1+cuda8.0_amd64.deb) because dev depends on the runtime (Thanks @tinmarino)


  1. Register on NVidia's website. It may take a day, or two before they'll get your account approved. At least that used to be the case back when I registered.
  2. Download and Install latest CUDA from NVidia, or the latest version that fits the software you'll be working with, if any, in this case your version of T-Flow.

    Note, that installing via ubuntu's standard package manager via clicking probably won't work appropriately.

    Instead, you'll probably have to follow these instructions in the terminal to install .deb pakage. After that you'll have to add a few lines to .bashrc, or wherever appropriate in your case. For example, if you're configuring a server, it's probably going to be a different place, maybe somewhere prior to your app's autolaunch, as .bashrc will probably not get executed in that case.

  3. Download CuDNN from NVidia

    I used the "Library for Linux" version, didn't have much luck with .deb packages.

  4. You can find where CUDA is located via which nvcc. Usually /usr/local/cuda/ will be a symbolic link to your currently installed version.

  5. Open CuDNN archive and copy appropriate contents into appropriate places within CUDA installation folder (cuda/lib64/ and cuda/include/). I usually sudo nautilus and do it from there visually.