Install TensorFlow on Rocky Linux

Last Updated:

This tutorial will show you how to install TensorFlow on Rocky Linux. According to their site, 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.

Install TensorFlow on Rocky Linux

There are various ways in which you can install TensorFlow;

  1. Install using Python PIP
  2. Install via Docker
  3. Build and install from the source.

We will only discuss the PIP installation method in this guide. For other methods refer to the documentation.

Before you can proceed with installation, be sure to check on hardware, system and software requirements.

Install TensorFlow using Python PIP

To install TensorFlow using Python PIP;

Install Python 3.x

TensorFlow requires Python 3.7-3.10.

Confirm the current Python version installed.

python3 -V

Sample output;

Python 3.9.7

If your version is lower than 3.7, you can install the required version using the package manager. Refer to the link below;

Install Python on Rocky Linux 8

Install PIP on Rocky Linux

pip version 19.0 or higher is required. You can install PIP on Rocky Linux using the command below;

sudo dnf install python3-pip

Install Required Python Libraries and Virtual Environment

Run the command below to install required Python libraries and virtual environment.

sudo dnf install python3-{virtualenv,devel}

Create TensorFlow Virtual Environment

Next, run the command below to install TensorFlow;

mkdir ~/tensorflow && cd ~/tensorflow

Create virtual environment, in this case we called our virtual environment, tensorflow_venv. You can use any name!

python3 -m venv tensorflow_venv

Activate the virtual environment created;

source ./tensorflow_venv/bin/activate

You will see the shell prompt change;

(tensorflow_venv) [kifarunix@rocky-linux ~]$

Upgrade PIP;

pip install --upgrade pip

Verify installed PIP version;

pip3.9 --version
pip 22.1.1 from /home/kifarunix/.local/lib/python3.9/site-packages/pip (python 3.9)

Install TensorFlow using PIP

Within the virtual environment, run the command below to install TensorFlow using PIP.

pip3.9 install --upgrade tensorflow

Check installed version of TensorFlow;

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

Sample output;


You can now use TensorFlow. Refer to the documentation for more information.

You can deactivate the virtual environment using the command;


You should see the shell prompt change.

And that is all on how TensorFlow can be installed on Rocky Linux.

Other Tutorials

Install Yarn on Rocky Linux 8

Install Latest Nodejs on Rocky Linux 8


We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
I am the Co-founder of, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

Leave a Comment