How to Install TensorFlow on Debian 11

Google’s TensorFlow is an open-source library to ease the processing of machine learning dependent tasks. For instance, TensorFlow acquires data, trains the model, and solves the predictions to refine future results. If we consider workflow of it, there are primarily two phases of a TensorFlow program: first phase is named as construction phase and another is execution phase. Graphs are built in construction phase whereas to evaluate these graphs execution phase comes into play. As compared to old versions, the latest releases of TensorFlow allows you to build programs in an effective and easy manner.

This framework is being used globally by several large-scale organizations and search engines as well: For example, a leading marketplace Airbnb applies TensorFlow framework to classify the images to improve their visitor’s experience. Moreover, another leading financial technology company PayPal practices TensorFlow to create complex fraud patterns and thus decreases the occurrence of fraud.

Linux operating system provides an open-source access and suitable for developers. Its distributions also provide same functionalities but in a decentralized manner. In this descriptive post, we will provide step-by-step procedure to install TensorFlow on Debian 11:

Before digging into installation of TensorFlow, let’s have a look at basic introduction for better understandability of TensorFlow:

How TensorFlow is better than its competitors

The major competitors of TensorFlow are PyTorch, Microsoft CNTK and Apache MXNet; these all frameworks somehow act same as Google’s TensorFlow, but they are useful for a particular scenario. For instance, PyTorch being built in python is beneficial for short term projects and provide fast processing for a short time, but it is not suitable for mega projects. On the other hand, TensorFlow being an open-source framework allows you to work on mega projects and effectively handle omplex workflows.

How to install TensorFlow on Debian 11

Following are the prerequisites for installing TensorFlow on Debian 11:


  • Latest version of Python3
  • Python package manager (pip)

The “Step 1” in this guide refers to check the availability of pre-requisites and will also guide you to install them (if not available on your Debian 11):

Step 1: Install Python3 and pip

Firstly, check the availability of python by using the below-mentioned command:

$ python3 --version 

In case your Debian 11 system do not have it; you can install it by using the following command:

$ sudo apt install python3

Similarity, execute the below mentioned command to check the version of pip:

$ pip --version 

Or if you want to install it; execute the following command in your Debian 11 terminal:

$ sudo apt install python3-pip

Step 2: Install Python virtual environment

First update the system’s repository by issuing the following command:

$ sudo apt update 

You can install python virtual environment (venv) with the help of command mentioned below:

$ sudo apt install python3-venv

Step 3: Create and activate a python based Virtual Environment

For virtual environment, we are creating a new directory and will change our working directory to that directory:

$ mkdir tfproject

Change the working directory to “/tfproject”:

$ cd tfproject

The above command will change present working directory to “~/tfproject” directory: After that you can create a virtual environment with the help of command stated below:

$ python3 -m venv venv

After creating this virtual environment, you must activate it by using the following command:

$ source venv/bin/activate

After activating the virtual environment, it is recommended to upgrade pip:

$ sudo pip install --upgrade pip

Step 4: Install TensorFlow

Once you have completed the list of prerequisites and created the virtual environment; you can now install TensorFlow with the help of following command:

Note: this command will install all the necessary packages along with TensorFlow.

$ sudo pip install --upgrade tensorflow 

Moreover, if you are done with virtual environment; you can deactivate with the help of following command (this keyword must be executed if you are in virtual environment):

$ deactivate

How to uninstall TensorFlow from Debian 11

If you do not need availability of TensorFlow on Debian 11; You can uninstall it by issuing the following command:

$ sudo pip uninstall tensorflow


TensorFlow is a widely used framework to assist machine learning programs in an effective manner. For instance, the library of TensorFlow is used by developers to build models and they can also create multi-layer neural networks. In this post, the guide to install TensorFlow on Debian 11 is provided; with the help of this article, you will also be able to create a python-based virtual environment for TensorFlow.