Install TensorFlow on Rocky Linux

0
126

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 on Rocky Linux;

How to install Rust programming lan...
How to install Rust programming language on Linux (Ubuntu, Fedora, Arch)
  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 on Rocky Linux using Python PIP

To install TensorFlow on Rocky Linux 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) [[email protected] ~]$
  • 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 on Rocky Linux using PIP

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

pip3.9 install --upgrade tensorflow

Check installed version of TensorFlow;

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

Sample output;

2.9.1

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

You can deactivate the virtual environment using the command;

deactivate

You should see the shell prompt change.

And that is all on how to install TensorFlow on Rocky Linux.

Other Tutorials

Install Yarn on Rocky Linux 8

Install Latest Nodejs on Rocky Linux 8

LEAVE A REPLY

Please enter your comment!
Please enter your name here