[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedSeptember 7, 2023

How to Install TensorFlow on CentOS 7.

How To Install TensorFlow On CentOS 7.

This tutorial will walk you through how to install TensorFlow on CentOS 7.

TensorFlow can be installed system-wide, in a Python virtual environment, as a Docker container or with Anaconda .

Installing TensorFlow on CentOS

TensorFlow supports both Python 2 and 3.

We will be using Python 3 and install TensorFlow inside a virtual environment. This way you can have multiple different isolated Python environments on a single computer and install a specific version of a module on a per project basis without worrying that it will affect your other Projects.

1. Installing Python 3

We will install Python 3.6 from the Software Collections (SCL) repositories.

CentOS 7 ships with Python 2.7.5 which is a critical part of the CentOS base system. SCL will allow you to install newer versions of python 3.x alongside the default python v2.7.5 so that system tools such as yum will continue to work properly.

To enable the repository, install the SCL release file:

sudo yum install centos-release-scl

Once done install Python 3.6 by running the following command:

sudo yum install rh-python36

We are now ready to create a virtual environment for our TensorFlow project.

2. Creating a Virtual Environment

Starting from Python 3.6, the recommended way to create a virtual environment is to use the venv module.

To access Python 3.6 you need to launch a new shell instance using the scl tool:

scl enable rh-python36 bash

Navigate to the directory where you would like to store your TensorFlow project. It can be your home directory or any other directory where the user has read and write permissions.

Create a new directory for the TensorFlow project and cd into it:

mkdir tensorflow_projectcd tensorflow_project

Within the directory, run the following command to create the virtual environment:

python3 -m venv venv

The command above creates a directory named venv, which contains a of the Python binary, the Pip package manager , the standard Python library and other supporting files. You can use any name you want for the virtual environment.

To start using this virtual environment, you need to activate it by running the activate script:

source venv/bin/activate

Once activated, the virtual environment’s bin directory will be added at the beginning of the $PATH variable . Also your shell’s prompt will change and it will show the name of the virtual environment you’re currently using. In this case that is venv.

TensorFlow installation requires pip version 19 or higher. Run the following command to upgrade pip to the latest version:

pip install --upgrade pip

3. Installing TensorFlow

Now that the virtual environment is activated, it’s time to install the TensorFlow library. To do so, type the following:

pip install --upgrade tensorflow

To verify the installation use the following command which will print the TensorFlow version:

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

At the time of writing this article, the latest stable version of TensorFlow is 2.0.0

2.0.0

Your TensorFlow version may differ from the version shown here.

If you are new to TensorFlow, visit the Get Started with TensorFlow page and learn how to build your first ML application. You can also clone the TensorFlow Models or TensorFlow-Examples repositories from Github and explore and test the TensorFlow examples.

Once you are done with your work, deactivate the environment, by typing deactivate and you will return to your normal shell.

deactivate

Conclusion

In this tutorial, we have shown you how to install TensorFlow on CentOS 7.

Keep reading
How to archive a file with tar gz. and gzip command.
October 9, 2023

How to archive a file with tar gz. and gzip command.

How To Archive A File With Tar Gz. And Gzip Command. Archiving and compressing files is a common task in Linux and Unix-based systems. This article will guide you through the process of creating and extracting tar.gz files using the tar and gzip commands. We will cover the basic syntax, options,…

Read article
How to use ulimit command in Linux.
October 6, 2023

How to use ulimit command in Linux.

How To Use Ulimit Command In Linux. ulimit is a built-in Linux shell command that allows viewing or limiting system resource amounts that individual users consume. Limiting resource usage is valuable in environments with multiple users and system performance issues. What Is limits.conf? The…

Read article
How to use tput command in Linux.
October 6, 2023

How to use tput command in Linux.

How To Use Tput Command In Linux. The tput command uses the terminfo database to make terminal-dependent information available to the shell. The tput command outputs a string if the attribute CapabilityName is of type string. The output string is an integer if the attribute is of type integer. If…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, cloud hosting, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00