How to Install TensorFlow on Ubuntu 20.04

Install TensorFlow on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure TensorFlow on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

TensorFlow™ is an open-source Machine Learning framework released by Google. From its official site, TensorFlow™ is an open-source software library for high-performance numerical computation, which allows easy deployment of computation across a variety of platforms (CPUs, GPUs, TPUs), and from desktops to clusters of servers to mobile and edge device.

Install TensorFlow on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

Step 2. Install Python.

By default, Python 3 comes with Ubuntu repositories. To install the python3-venv package run the following command:

Step 3. Create TensorFlow Directory.

Once the module is installed, you are ready to create a virtual environment for our TensorFlow project:

Within the directory, run the following command to create the virtual environment:

To start using the virtual environment, activate it by running the activate script:

Step 4. Install TensorFlow on the Ubuntu system.

To install the current release, which includes support for CUDA-enabled GPU cards (Ubuntu and Windows):

Or if you’re a bit of a resource, use this other package:

In case you want to update TensorFlow and Pip, just execute these commands:

To verify the installation, run the following command, which will print the TensorFlow version:

The command should output the version of TensorFlow:

When you’re done with your Python environment, simply run the commands below to deactivate:

That’s all you need to do to install TensorFlow on Ubuntu 20.04 Focal Fossa. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.