CentOS 7
Sponsored Link

TensorFlow : Install2018/01/23

 
Install TensorFlow which is the Machine Learning Library.
On this example, Install TensorFlow 2.0.
[1]
[2] Install other required packages.
[root@dlp ~]#
yum -y install python3-devel python-virtualenv gcc gcc-c++ make
[3] Login as a common user and prepare Python virtual environment to install TensorFlow.
If you'd like to install it on System Wide, skip this section and execute the next [4] with root user account.
[cent@dlp ~]$
virtualenv --system-site-packages -p python3 ./venv

Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/cent/venv/bin/python3
Also creating executable in /home/cent/venv/bin/python
Installing setuptools, pip, wheel...done.

[cent@dlp ~]$
source ./venv/bin/activate

(venv) [cent@dlp ~]$
[4] Install TensorFlow 2.0.
(venv) [cent@dlp ~]$
pip3 install --upgrade tensorflow==2.0.0b1
# confirm numpy version

(venv) [cent@dlp ~]$
pip3 show numpy
Name: numpy
Version: 1.19.1
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: /home/cent/venv/lib/python3.6/site-packages
Requires:
Required-by: tensorflow, tb-nightly, Keras-Preprocessing, Keras-Applications, h5py

# on TensorFlow 2.0 + numpy 1.17 or later,

# many Warnings are displayed, so downgrade to 1.16

(venv) [cent@dlp ~]$
pip3 install --upgrade numpy==1.16.0

(venv) [cent@dlp ~]$
pip3 show numpy

Name: numpy
Version: 1.16.0
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: /home/cent/venv/lib/python3.6/site-packages
Requires:
Required-by: tensorflow, tb-nightly, Keras-Preprocessing, Keras-Applications, h5py

# verify to run TensorFlow

(venv) [cent@dlp ~]$
python3 -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

2020-07-23 19:51:54.320919: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2801685000 Hz
2020-07-23 19:51:54.322853: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x2bdacd0 executing computations on platform Host. Devices:
2020-07-23 19:51:54.322908: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>
tf.Tensor(-695.68384, shape=(), dtype=float32)

# Hello World on TensorFlow

(venv) [cent@dlp ~]$
python3 -c "import tensorflow as tf; hello = tf.constant('Hello, TensorFlow World'); tf.print(hello)"

2020-07-24 09:52:34.792214: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2801685000 Hz
2020-07-24 09:52:34.794043: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x27d2f30 executing computations on platform Host. Devices:
2020-07-24 09:52:34.794099: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>
Hello, TensorFlow World
Matched Content