This guide intends to teach you to Install TensorFlow on Rocky Linux 8.
TensorFlow is an open-source library for numerical computation, large-scale machine learning, deep learning, and other statistical and predictive analytics workloads. This type of technology makes it faster and easier for developers to implement machine learning models, as it assists the process of acquiring data, serving predictions at scale, and refining future results.
Steps To Install TensorFlow on Rocky Linux 8
TensorFlow can be installed system-wide, in a Python virtual environment, as a Docker container, or with Anaconda.
To install TensorFlow, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article on the Initial Server Setup with Rocky Linux 8.
Here we will install TensorFlow in a Python virtual environment.
Set up TensorFlow on Rocky Linux 8
You need to install Python on your Rocky Linux 8.
First, update your local package index with the following command:
sudo dnf update -y
Install Python 3
Then, install Python 3 on your server with the following command:
sudo dnf install python3 -y
This command will install Python 3.6 and pip. To run Python3 you need to use python3 and to run the pip you need to type pip3.
Now switch to a directory where you want to store your TensorFlow project. It can be your home directory or any other directory where the user has read and write permissions.
Then, you need to create a new directory for your TensorFlow project and switch to it on Rocky Linux 8 with the following commands:
# mkdir tensorflow_project
# cd tensorflow_project
Create Virtual Environment
Next, use the venv module to create a new virtual environment:
python3 -m venv venv
This command will create a new directory named venv. You can choose another name for your virtual environment.
Activate Virtual Environment
To use the virtual environment, you need to activate it with the following command:
You will see that your shell’s prompt will change to the name of the virtual environment.
The TensorFlow installation on Rocky Linux 8 needs pip version 19 or higher.
Use the following command to upgrade pip to the latest version:
(venv) $ pip install --upgrade pip
Here you can use the following command to install TensorFlow:
(venv) $ pip install --upgrade tensorflow
Note: If you have a dedicated NVIDIA GPU and want to take advantage of its processing power, instead of
tensorflow, install the
tensorflow-gpu package, which includes GPU support.
Note: From the virtual environment, you can use the command
pip instead of
python instead of
When your installation is completed, verify it by checking the TensorFlow version:
(venv) $ python -c 'import tensorflow as tf; print(tf.__version__)'
Your TensorFlow version may be different from here.
When you are done with your work you can deactivate your virtual environment with the following command:
(venv) $ deactivate
That’s it, you are done.
At this point, you have learned to Install TensorFlow on Rocky Linux 8.
Hope you enjoy it. For more articles, you can visit the Orcacore Website.