How to Install TensorFlow on CentOS 8
TensorFlow is an open-source platform for machine studying constructed by Google. It will probably runs on CPU or GPU on totally different units, and it’s utilized by quite a lot of organizations, together with Twitter, PayPal, Intel, Lenovo, and Airbus.
TensorFlow will be put in system-wide, in a Python digital setting, as a Docker container, or with Anaconda.
This tutorial explains the best way to set up TensorFlow on CentOS 8.
TensorFlow helps each Python 2 and three. We might be utilizing Python Three and set up TensorFlow inside a digital setting. A digital setting permits you to have a number of totally different remoted Python environments on a single laptop and set up a selected model of a module on a per-project foundation, with out worrying that it’s going to have an effect on your different Tasks.
Putting in TensorFlow on CentOS #
Not like different Linux distributions, Python is just not put in by default on CentOS 8. To install Python 3 on CentOS 8 run the next command as root or sudo consumer in your terminal:
sudo dnf set up python3
The command above will set up Python 3.6 and pip. To run Python 3, it’s essential to kind
python3 explicitly, and to run pip kind
Ranging from Python 3.6, the really helpful technique to create a digital setting is to make use of the
Navigate to the directory the place you want to retailer your TensorFlow venture. It may be your own home listing or every other listing the place the consumer has learn and write permissions.
Create a new directory for the TensorFlow venture and change into it:
Inside the listing, run the next command to create the digital setting:
python3 -m venv venv
The command above creates a listing named
venv, containing a duplicate of the Python binary, pip the usual Python library, and different supporting information. You need to use any identify you need for the digital setting.
To start out utilizing the digital setting, activate it by typing:
As soon as activated, the digital setting’s bin listing might be added firstly of the
$PATH variable. Additionally, your shell’s immediate will change, and it’ll present the identify of the digital setting you’re at present utilizing. On this case, that’s
TensorFlow set up requires
pip model 19 or larger. Run the next command to improve
pip to the most recent model:
pip set up --upgrade pip
Now that the digital setting is created and activated, set up the TensorFlow library utilizing the next command:
pip set up --upgrade tensorflow
If in case you have a devoted NVIDIA GPU and need to reap the benefits of its processing energy, as a substitute of
tensorflow, set up the
tensorflow-gpu package deal, which incorporates GPU assist.
Inside the digital setting, you need to use the command
pip as a substitute of
python as a substitute of
To confirm the set up, run the next command, which is able to print the TensorFlow model:
python -c 'import tensorflow as tf; print(tf.__version__)'
On the time of writing this text, the most recent secure model of TensorFlow is 2.1.0:
Your TensorFlow model could differ from the model proven right here.
If you’re new to TensorFlow, go to the Get Started with TensorFlow web page and discover ways to construct your first ML software. It’s also possible to clone the TensorFlow Models or TensorFlow-Examples repositories from Github and discover and take a look at the TensorFlow examples.
As soon as you’re accomplished along with your work, deactivate the setting by typing
deactivate, and you’ll return to your regular shell.
That’s it! You’ve got efficiently put in TensorFlow, and you can begin utilizing it.
We’ve got proven you the best way to set up TensorFlow inside a digital setting on CentOS 8.
In case you hit an issue or have suggestions, depart a remark under.