YouTube Icon

Code Playground.

How to Install TensorFlow on Ubuntu 20.04


How to Install TensorFlow on Ubuntu 20.04

TensorFlow is a free and open-source stage for AI worked by Google. It is utilized by various associations, including Twitter, PayPal, Intel, Lenovo, and Airbus. 

TensorFlow can be introduced framework wide, in a Python virtual climate, as a Docker compartment, or with Anaconda. 

This instructional exercise discloses how to introduce TensorFlow in a Python virtual climate on Ubuntu 20.04. 

A virtual climate permits you to have various distinctive separated Python conditions on a solitary PC and introduce a particular form of a module on a for every task premise, without stressing that it will influence your different Projects. 

Installing TensorFlow on Ubuntu 20.04

Ubuntu 20.04 boats with Python 3.8 naturally. You can check that Python 3 is introduced on your framework by composing: 

python3 -V

The yield should resemble this: 

Python 3.8.2

The prescribed method to establish a virtual climate is by utilizing the venv module, which is remembered for the python3-venv bundle. 

To introduce the python3-venv bundle run the accompanying order: 

sudo apt install python3-venv python3-dev

When the module is introduced, you are prepared to establish a virtual climate for our TensorFlow undertaking. 

Explore to the catalog where you might want to store your Python 3 virtual conditions. It very well may be your home catalog or whatever other index where your client has peruse and compose consents. 

Make another index for the TensorFlow task and disc into it: 

mkdir my_tensorflow
cd my_tensorflow

Inside the index, run the accompanying order to establish the virtual climate: 

source venv/bin/activate

The second venv is the name of the virtual climate. You can utilize any name you need for the virtual climate. 

The order above makes a catalog named venv, that contains a duplicate of the Python twofold, the Pip bundle director , the standard Python library, and other supporting records. 

To begin utilizing the virtual climate, enact it by running the actuate content: 

source venv/bin/activate

When enacted, the virtual climate's container index will be included toward the start of the framework $PATH variable . Additionally, the shell's brief will change, and it will show the name of the virtual climate you're at present in. In this model, that is (venv). 

TensorFlow establishment requires pip variant 19 or higher. Enter the accompanying order to redesign pip to the most recent adaptation: 

pip install --upgrade pip

Since the virtual climate is initiated, it's an ideal opportunity to introduce the TensorFlow bundle. 

pip install --upgrade tensorflow

On the off chance that you have a committed NVIDIA GPU and need to exploit its preparing power, rather than tensorflow, introduce the tensorflow-gpu bundle, which incorporates GPU uphold. 

Inside the virtual climate, you can utilize the order pip rather than pip3 and python rather than python3. 

That is it! You have effectively introduced TensorFlow, and you can begin utilizing it. 

To confirm the establishment, run the accompanying order, which will print the TensorFlow rendition: 

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

At the hour of composing this article, the most recent stable form of TensorFlow is 2.2.0: 


Your TensorFlow rendition may vary from the form appeared here. 

In the event that you are new to TensorFlow, visit the Get Started with TensorFlow page and figure out how to fabricate your first ML application. You can likewise clone the TensorFlow Models or TensorFlow-Examples stores from Github and investigate and test the TensorFlow models. 

When you are finished with your work, deactivate the climate by composing deactivate, and you will re-visitation of your ordinary shell. 



We have told you the best way to introduce TensorFlow inside a virtual climate on Ubuntu 20.04. 

In the event that you hit an issue or have criticism, leave a remark underneath.