Reading Time: 4 minutes

If you have not yet been introduced to Machine Learning, TensorFlow is Google's open-source, Machine Learning (ML) platform that aims to simplify developing ML models. It is a symbolic math toolbox that performs several tasks, such as deep neural network training and inference using dataflow and differentiable programming.

Learning TensorFlow's Toolkit, History & How to Install TensorFlow

TensorFlow has a vast, adaptable ecosystem of tools, libraries, and community resources that enable researchers to improve the state-of-the-art Machine Learning and developers to create and deploy ML-powered apps quickly. Various organizations utilize TensorFlow, including Twitter, PayPal, Intel, Lenovo, and Airbus.

The Google Brain research team that has been developing TensorFlow since 2011 was merged with the Google DeepMind team in April 2023. The TensorFlow tool that Google Brain created lets neural networks to be used by the public. Learn how to install TensorFlow on the AlmaLinux Operating System (OS) with minimal steps.


  • Operating System and Version: AlmaLinux OS 8.
  • System root access or admin user privileges using the sudo command

Installing TensorFlow on AlmaLinux

Review the following steps to ramp up on how to install TensorFlow on the AlmaLinux OS.

Step 1: Update Your AlmaLinux System

You must first install the Extra Packages for Enterprise Linux (EPEL) repository by executing the following command to get the necessary packages and dependencies:

~]# sudo dnf install epel-release -y

Then, you can update the AlmaLinux system by executing the following command:

~]# sudo dnf update -y

Step 2: Install Python 3

Python is not included in the AlmaLinux base repository by default. So, you must execute the following command to install the newest stable version of Python on your AlmaLinux system. This command will help you install Python 3.6.8 as well as Pip. To use Python3, type python3, and to use Pip, type pip3:

~]# sudo dnf install python3 -y

Here is the output:

[root@TensorFlow-AlmaLinux ~]# sudo dnf install python3 -y
Last metadata expiration check: 0:04:10 ago on Thu 15 Jun 2023 05:41:57 AM UTC.
Dependencies resolved.
 Package                                  Architecture                 Version                                                     Repository                       Size
 python36                                 x86_64                       3.6.8-38.module_el8.5.0+2569+5c5719bc                       appstream                        18 k
Installing dependencies:
 python3-pip                              noarch                       9.0.3-22.el8                                                appstream                        19 k
 python3-setuptools                       noarch                       39.2.0-7.el8                                                baseos                          162 k
Enabling module streams:
 python36                                                              3.6                                                                                              

Transaction Summary
Install  3 Packages

Total download size: 199 k
Installed size: 466 k
Downloading Packages:
(1/3): python36-3.6.8-38.module_el8.5.0+2569+5c5719bc.x86_64.rpm                                                                         126 kB/s |  18 kB     00:00    
(2/3): python3-setuptools-39.2.0-7.el8.noarch.rpm                                                                                        550 kB/s | 162 kB     00:00    
(3/3): python3-pip-9.0.3-22.el8.noarch.rpm                                                                                                44 kB/s |  19 kB     00:00    
Total                                                                                                                                    145 kB/s | 199 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                 1/1 
  Installing       : python3-setuptools-39.2.0-7.el8.noarch                                                                                                          1/3 
  Installing       : python3-pip-9.0.3-22.el8.noarch                                                                                                                 2/3 
  Installing       : python36-3.6.8-38.module_el8.5.0+2569+5c5719bc.x86_64                                                                                           3/3 
  Running scriptlet: python36-3.6.8-38.module_el8.5.0+2569+5c5719bc.x86_64                                                                                           3/3 
  Verifying        : python3-setuptools-39.2.0-7.el8.noarch                                                                                                          1/3 
  Verifying        : python3-pip-9.0.3-22.el8.noarch                                                                                                                 2/3 
  Verifying        : python36-3.6.8-38.module_el8.5.0+2569+5c5719bc.x86_64                                                                                           3/3 

  python3-pip-9.0.3-22.el8.noarch               python3-setuptools-39.2.0-7.el8.noarch               python36-3.6.8-38.module_el8.5.0+2569+5c5719bc.x86_64              


Once all the packages are installed, you can execute the following command to verify the Python version:

~]# python3 -V

Here is the output:

[root@TensorFlow-AlmaLinux ~]# python3 -V
Python 3.6.8
[root@TensorFlow-AlmaLinux ~]# 

Step 3: Create TensorFlow Virtual Environment

Run these commands to create a directory for your TensorFlow project, as well as switch to the directory where you want to store your TensorFlow project. Please replace the example sample_tensorflow project name shown below as per your requirements:

~]# mkdir sample_tensorflow
~]# cd sample_tensorflow

You can use the venv module to create a virtual environment under the directory sample_tensorflow.

~]# python3 -m venv sample_venv

This command will help you to create a new directory named sample_venv. It contains only the necessary files, such as the Python executable file, the Pip executable file, and some additional libraries. You can choose a different name for your virtual environment per your requirements.

You will need to activate the virtual environment with the following command before using it:

~]# source venv/bin/activate

The prompt in your shell will now display the name of the virtual environment. Here is the output:

[root@TensorFlow-AlmaLinux ~]# mkdir sample_tensorflow
[root@TensorFlow-AlmaLinux ~]# cd sample_tensorflow
[root@TensorFlow-AlmaLinux sample_tensorflow]# python3 -m venv sample_venv
[root@TensorFlow-AlmaLinux sample_tensorflow]# source venv/bin/activate
[root@TensorFlow-AlmaLinux sample_tensorflow]#

Step 4: Install TensorFlow on AlmaLinux

As you learn how to install TensorFlow, you should be aware that it requires Pip 19.0 or above for installation. To upgrade Pip to the latest version, issue this command:

~]# pip install --upgrade pip

Here is the output:

(venv) [root@TensorFlow-AlmaLinux ~]# pip install --upgrade pip
Collecting pip
  Downloading (1.7MB)
    100% |████████████████████████████████| 1.7MB 521kB/s 
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-21.3.1

Then, you can install the TensorFlow package by executing the following command:

~]# pip install --upgrade tensorflow

Here is the output:

(venv) [root@TensorFlow-AlmaLinux ~]# pip install --upgrade tensorflow
Collecting tensorflow
  Downloading tensorflow-2.6.2-cp36-cp36m-manylinux2010_x86_64.whl (458.3 MB)
     |████████████████████████████████| 458.3 MB 13 kB/s               
Collecting tensorflow-estimator<2.7,>=2.6.0
  Downloading tensorflow_estimator-2.6.0-py2.py3-none-any.whl (462 kB)
     |████████████████████████████████| 462 kB 99.5 MB/s            
Collecting h5py~=3.1.0
  Downloading h5py-3.1.0-cp36-cp36m-manylinux1_x86_64.whl (4.0 MB)
     |████████████████████████████████| 4.0 MB 68.8 MB/s            
Collecting wrapt~=1.12.1
  Downloading wrapt-1.12.1.tar.gz (27 kB)
  Preparing metadata ( ... done


  Downloading oauthlib-3.2.2-py3-none-any.whl (151 kB)
     |████████████████████████████████| 151 kB 92.2 MB/s            
Using legacy ' install' for clang, since package 'wheel' is not installed.
Using legacy ' install' for termcolor, since package 'wheel' is not installed.
Using legacy ' install' for wrapt, since package 'wheel' is not installed.
Installing collected packages: urllib3, pyasn1, idna, charset-normalizer, certifi, zipp, typing-extensions, six, setuptools, rsa, requests, pyasn1-modules, oauthlib, cachetools, requests-oauthlib, importlib-metadata, google-auth, dataclasses, wheel, werkzeug, tensorboard-plugin-wit, tensorboard-data-server, protobuf, numpy, markdown, grpcio, google-auth-oauthlib, cached-property, absl-py, wrapt, termcolor, tensorflow-estimator, tensorboard, opt-einsum, keras-preprocessing, keras, h5py, google-pasta, gast, flatbuffers, clang, astunparse, tensorflow
  Attempting uninstall: setuptools
    Found existing installation: setuptools 39.2.0
    Uninstalling setuptools-39.2.0:
      Successfully uninstalled setuptools-39.2.0
    Running install for wrapt ... done
    Running install for termcolor ... done
    Running install for clang ... done
Successfully installed absl-py-0.15.0 astunparse-1.6.3 cached-property-1.5.2 cachetools-4.2.4 certifi-2023.5.7 charset-normalizer-2.0.12 clang-5.0 dataclasses-0.8 flatbuffers-1.12 gast-0.4.0 google-auth-1.35.0 google-auth-oauthlib-0.4.6 google-pasta-0.2.0 grpcio-1.48.2 h5py-3.1.0 idna-3.4 importlib-metadata-4.8.3 keras-2.6.0 keras-preprocessing-1.1.2 markdown-3.3.7 numpy-1.19.5 oauthlib-3.2.2 opt-einsum-3.3.0 protobuf-3.19.6 pyasn1-0.5.0 pyasn1-modules-0.3.0 requests-2.27.1 requests-oauthlib-1.3.1 rsa-4.9 setuptools-59.6.0 six-1.15.0 tensorboard-2.6.0 tensorboard-data-server-0.6.1 tensorboard-plugin-wit-1.8.1 tensorflow-2.6.2 tensorflow-estimator-2.6.0 termcolor-1.1.0 typing-extensions- urllib3-1.26.16 werkzeug-2.0.3 wheel-0.37.1 wrapt-1.12.1 zipp-3.6.0

You have now learned how to install TensorFlow on AlmaLinux, but let's verify the success of your installation.

Step 5: Verify the TensorFlow Installation

You can execute the following command to verify the TensorFlow installation:

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

Here is the output:

(venv) [root@TensorFlow-AlmaLinux ~]# python -c 'import tensorflow as tf; print(tf.__version__)'

Now, it has been confirmed that you know how to install TensorFlow on AlmaLinux. Congratulations!

Step 6: Turn Off Your Virtual Environment (as Needed)

To turn off your virtual environment, you can execute the following command:

~]# deactivate

Here is the output:

(venv) [root@TensorFlow-AlmaLinux ~]# deactivate
[root@TensorFlow-AlmaLinux ~]# 

Wrapping Up How to Install TensorFlow on AlmaLinux

TensorFlow is a free and open-source, end-to-end framework for developing Machine Learning applications. Technologists like that TensorFlow simplifies collecting data, training models, making predictions, and correcting future results.

You should now understand what TensorFlow is and how to install TensorFlow on the AlmaLinux OS. If you require any assistance optimizing your website's setup that has been hosted with Liquid Web, please reach out to our team of Helpful Humans.

Avatar for Mohammed Noufal

About the Author: Mohammed Noufal

Mohammed Noufal is a B.Tech graduate with a decade of experience in server administration and web hosting. He is a father to two daughters and finds fulfillment in their growth. In his free time, he enjoys blogging, sharing experiences, and listening to music. With a strong technical background, family commitment, and creative outlets, he represents a well-rounded life journey.

Latest Articles

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change the root password in WebHost Manager (WHM)

Read Article