Installing TensorFlow-GPU on Ubuntu 20.04 or Windows 10

Tensorflow GPU Installation 

At first, install Miniconda or Anaconda by following the instructions provided here. Then run the following command in the terminal.

>>> conda create --name tf_gpu tensorflow-gpu 

This command will create an environment first named with ‘tf_gpu’ and will install all the packages required by tensorflow-gpu including the cuda and cuDNN compatible verisons.

The command above is combination of 3 commands given below:

>>> conda create --name tf_gpu

>>> activate tf_gpu

>>> conda install tensorflow-gpu

After running the command, if the TensorFlow-GPU is installed correctly, you should see the following message in the terminal.

Testing your Tensorflow-GPU Installation

To test your tensorflow installation follow these steps:

Verify that TensorFlow can detect your GPU by running the following command:

>>> import tensorflow as tf

>>> tf.config.list_physical_devices("GPU") 

You should get a message as below indicating the GPU(s) on your machine.


Thank you!