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

  1. Right before we install CUDA, we need to make sure that your GPU is CUDA-capable. If no results are returned after this command, sorry, your GPU doesn’t support 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.

  1. Right before we get started, install Anaconda so we don’t get errors while running TensorFlow GPU. To install Anaconda, go to this link here:
  2. Now, create a virtual Anaconda environment.
  3. Create a virtual environment in Anaconda called tf-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




Living in The Milky Way 😀

Love podcasts or audiobooks? Learn on the go with our new app.

Sobel vs. Canny Edge Detection Techniques: Step by Step Implementation

Machine Learning : Biosignal Data Analytics

What exactly is machine learning?

Hierarchical Softmax as output activation function in Neural Network — Part 2

Predict Inventory Damages in Real Time With Machine Learning

Recognizing Handwritten Digits Using Machine Learning

[TF vs. PyTorch] MNIST tutorial

k-means Clustering Algorithm: Explained and Implemented

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aaron Ma

Aaron Ma

Living in The Milky Way 😀

More from Medium

Step by step guide to setup Tensorflow with GPU support on windows 10

Generative Pre-trained Transformer 3 by OpenAI

Connect to Google Colab Using SSH

Python: Send Line Message with Sticker and Image (Python串接Line)