How to Install TensorFlow on CentOS 8

Install TensorFlow on CentOS 8

In this article, we will have explained the necessary steps to installing and configure TensorFlow on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

TensorFlow™ is an open-source Machine Learning framework released by Google. From its official site, TensorFlow™ is an open-source software library for high-performance numerical computation, which allows easy deployment of computation across a variety of platforms (CPUs, GPUs, TPUs), and from desktops to clusters of servers to mobile and edge device.

Install TensorFlow on CentOS 8

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo dnf install epel-release
sudo dnf update

Step 2. Install Python 3 and Venv.

Run the following command as root or sudo user in your terminal to install Python packages:

sudo dnf install python3

Step 3. Creating Virtual Environment.

Now create a new directory and name it as ‘tensorflow_project’ for the TensorFlow project and then switch in this directory. Use the following command to perform these actions:

mkdir tensorflow_project
cd tensorflow_project

To create the virtual environment, run the following command:

python3 -m venv venv

To activate it run the activate script:

source venv/bin/activate

Once the virtual environment is activated, a bin directory will add at the beginning of the path, and the prompt of the terminal will change that will show currently using the name of the virtual environment. Here, we are using the name ‘venv’.

Step 3. Install TensorFlow on the CentOS system.

Now install the TensorFlow library using the following command:

pip install --upgrade pip
pip install --upgrade tensorflow

To verify the installation, run the following command:

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

That’s all you need to do to install TensorFlow on CentOS 8. I hope you find this quick tip helpful. For further reading on TensorFlow, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.