30.8 C
Senior Writer and partner

How to install TensorFlow on Ubuntu 20.04?

Hi, folks. This time you will learn how to install Tensorflow on Ubuntu 20.04.

According to the project website, “Tensorflow is an end-to-end open source platform for machine learning. It has a comprehensive, flexible ecosystem of tools, libraries and community resources that lets researchers push the state-of-the-art in ML and developers easily build and deploy ML powered applications”.

Therefore, with Tensorflow you can build neural networks to decipher patterns used by humans. It is also important to say that, it is open-source and is currently used by Google, which shows us the power of it.

Tensorflow is very efficient in managing computer resources because it allows you to deploy computing to one or more CPUs or GPUs on desktops, servers, or mobile devices with a single API.

- Advertisement -

So, if you’re going to work with it, or are curious about this technology, it’s a good idea to know how to install it.

Installing Tensorflow on Ubuntu 20.04

Since Python comes installed on all Linux distributions, the first step is to install the virtual language environment.

:~$ sudo apt install python3-venv
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
python-pip-whl python3.8-venv
The following NEW packages will be installed:
python-pip-whl python3-venv python3.8-venv
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 1805 kB of archives.
After this operation, 2343 kB of additional disk space will be used.
Do you want to continue? [Y/n]
1.- Installing Tensorflow on Ubuntu 20.04
1.- Installing Tensorflow on Ubuntu 20.04

Once the package has been installed, it is convenient to create a new folder where we will install Tensorflow. You can call it by the same name or whatever you want.

:~$ mkdir TensorFlow

Then, access it and from there, start the virtual environment.

:~$ cd TensorFlow
:~$ python3 -m venv venv

The next step is to activate the virtual environment of Python.

:~$ source venv/bin/activate
2.- Activating the virtual env
2.- Activating the virtual env

This is the best way to install and use Tensorflow because it allows you to isolate it from the rest of the system. This provides even more stability.

Tensorflow can now be installed. If your computer is advanced and has a good GPU, you can install the standard version.

:~$ pip install tensorflow

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

:~$ pip install tensorflow-cpu

In any case, you will have the package installed and ready to go.

To check that everything went well, you can execute the following command:

python -c 'import tensorflow as tf; print(tf.version)'

And you’ll get a screen output like the one below:


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

pip install --upgrade pip
pip install --upgrade tensorflow

Finally, to close the virtual environment, run:


Now you can start using Tensorflow on Ubuntu 20.04


Tensorflow is a very interesting tool dedicated to a very delicate section of our lives. In fact, great decisions have been made using the data originated by Tensorflow.

Now that you know how to install it, there are no excuses to keep moving forward with it.

Please share this post and join our Telegram channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article