This page was made for installation of tensorflow 1.8.0. Go to https://www.tensorflow.org/install/linux/ to check latest version.
Installing the Nvidia drivers
Add the graphics drivers PPA :
sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update
Select the required graphics driver:
Open software updater and select settings
Select the required Drivers from Additional drivers tab
Nvidia driver version 390 is a requirement for Cuda 9.1. But for tensorflow 1.8 we require Cuda 9.0 (Cuda 9.1 wont work). So Nvidia driver version 384 and above should work.
CUDA Toolkit 9.0
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}/usr/local/cuda/extras/CUPTI/lib64
Installing CUDA Toolkit
TensorFlow requires CUDA Toolkit 9.0. But the CUDA Toolkit 9.0 link in the TensorFlow website redirects to latest CUDA Toolkit (9.2 at time of this post). Use the following link to download CUDA Toolkit 9.0 from the archive.
CUDA Toolkit 9.0
Installing cuDNN
cuDNN SDK v7. For details, see NVIDIA's documentation. Ensure that you create the
CUDA_HOME environment variable as described in the NVIDIA documentation.Install libcupti-dev library
libcupti-dev is the NVIDIA CUDA Profile Tools Interface. This library provides advanced profiling support. To install this library, issue the following command for CUDA Toolkit >= 9.0:
sudo apt install cuda-command-line-tools-9-0
and add its path to your
LD_LIBRARY_PATH environment variable:
[OPTIONAL] For optimized inferencing performance, you can also install NVIDIA TensorRT 3.0. The minimal set of TensorRT runtime components needed for use with the pre-built
tensorflow-gpu package can be installed as follows:$ wget https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/nvinfer-runtime-trt-repo-ubuntu1404-3.0.4-ga-cuda9.0_1.0-1_amd64.deb $ sudo dpkg -i nvinfer-runtime-trt-repo-ubuntu1404-3.0.4-ga-cuda9.0_1.0-1_amd64.deb $ sudo apt-get update $ sudo apt-get install -y --allow-downgrades libnvinfer-dev libcudnn7-dev=7.0.5.15-1+cuda9.0 libcudnn7=7.0.5.15-1+cuda9.0
IMPORTANT: For compatibility with the pre-built
tensorflow-gpu package, please use the Ubuntu 14.04 package of TensorRT as shown above, even when installing onto an Ubuntu 16.04 system.
To avoid cuDNN version conflicts during later system upgrades, you can hold the cuDNN version at 7.0.5:
$ sudo apt-mark hold libcudnn7 libcudnn7-dev
To later allow upgrades, you can remove the hold:$ sudo apt-mark unhold libcudnn7 libcudnn7-dev
If you have an earlier version of the preceding packages, please upgrade to the specified versions.
Determine how to install TensorFlow
You must pick the mechanism by which you install TensorFlow. The supported choices are as follows:
- Virtualenv
- "native" pip
- Docker
- Anaconda
- installing from sources


