Share your love
How To Install TensorFlow on AlmaLinux 8
In this article, we want to teach you How To Install TensorFlow on AlmaLinux 8.
TensorFlow is an open-source end-to-end framework for building Machine Learning apps.
It’s a symbolic math toolkit that performs a variety of tasks including deep neural network training and inference using dataflow and differentiable programming.
It enables programmers to construct machine learning applications by utilizing a variety of tools, frameworks, and community resources.
Install TensorFlow on AlmaLinux 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 about the Initial Server Setup with AlmaLinux 8.
Now follow the steps below to install TensorFlow.
Installing TensorFlow
You need to install Python on your AlmaLinux 8. First, update your local package index with the following command:
sudo dnf update
Then, install Python 3 on your server with the following command:
sudo dnf install python3
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 AlmaLinux 8 with the following commands:
$mkdir tensorflow_project
$cd tensorflow_project
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.
To use the virtual environment, you need to activate it with the following command:
source venv/bin/activate
You will see that your shell’s prompt will change to the name of the virtual environment.
The TensorFlow installation on AlmaLinux 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 pip3
and python
instead of python3
.
When your installation is completed, verify it by checking the TensorFlow version:
(venv) $ python -c 'import tensorflow as tf; print(tf.__version__)'
At the time of writing this article, the latest stable version of TensorFlow is 2.7.0:
Output
2.7.0
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
Conclusion
At this point, you learn to install TensorFlow on AlmaLinux 8 and you can start using it.
Hope you enjoy it.
May this article about How To Install TensorFlow on Centos 7 be useful for you.