How to Setup TensorFlow GPU 2.2 with NVIDIA GPUs

Hello world, it’s Aaron!

NOTE: This article assumes you are on a Linux distro with at least 1 CUDA-capable NVIDIA GPU.

In this article, we will be installing NVIDIA CUDA and TensorFlow GPU 2.2.0-rc2!

Image Copyright TensorFlow.
Image Copyright NVIDIA.

Install CUDA

lspci | grep -i nvidia

2. Check you have a supported version of Linux:

uname -m && cat /etc/*release

3. Install GNU G++.

4. Install CUDA 10.1 (not CUDA 10.2, as TensorFlow GPU currently doesn't support CUDA 10.2) by clicking the link for your Linux distro:

5. Follow the instructions for deb(local).

6. Install cuDNN for CUDA 10.1 by clicking here:

Install Anaconda and TensorFlow GPU

Great job on setting up CUDA! Now for the meat of this article: Installing TensorFlow GPU.

conda create --name tf-gpu

4. Now, source into the virtual environment. Remember, every time you want to use this virtual environment, you must run this command!

conda activate tf-gpu

5. Install TensorFlow GPU with pip:

pip install tensorflow-gpu==2.2.0rc2

6. Create a new Python 3 shell:


7. Test your TensorFlow GPU installation:

import tensorflow as tf
tf.__version__ # Result should be '2.2.0-rc2'
tf.config.list_physical_devices('GPU') # should list all available GPUs

Congratulations on setting up your computer for TensorFlow GPU 2.2.0-rc2!

-Aaron Ma