Ubuntu 20.04
Sponsored Link

TensorFlow : Install2020/07/27

 
Install TensorFlow which is the Machine Learning Library.
On this example, Install TensorFlow 2.2.
[1]
[2] Install other required packages.
root@dlp:~#
apt -y install python3-dev virtualenv gcc g++ 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.
ubuntu@dlp:~$
virtualenv --system-site-packages -p python3 ./venv

created virtual environment CPython3.8.2.final.0-64 in 948ms
  creator CPython3Posix(dest=/home/ubuntu/venv, clear=False, global=True)
  seeder FromAppData(download=False, setuptools=latest, CacheControl=latest, six=latest, pkg_resources=latest, idna=latest, webencodings=latest, pip=latest, urllib3=latest, distro=latest, html5lib=latest, pytoml=latest, ipaddr=latest, msgpack=latest, packaging=latest, chardet=latest, progress=latest, certifi=latest, pyparsing=latest, retrying=latest, colorama=latest, lockfile=latest, requests=latest, distlib=latest, appdirs=latest, wheel=latest, pep517=latest, contextlib2=latest, via=copy, app_data_dir=/home/ubuntu/.local/share/virtualenv/seed-app-data/v1.0.1.debian)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

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

(venv) ubuntu@dlp:~$
[4] Install TensorFlow 2.2.
(venv) ubuntu@dlp:~$
pip3 install --upgrade tensorflow==2.2.0
# run TensorFlow

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

2020-07-23 19:54:38.164946: I tensorflow/core/platform/profile_utils/cpu_utils.cc:102] CPU Frequency: 2801850000 Hz
2020-07-23 19:54:38.167010: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7f52e8000b60 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-07-23 19:54:38.167276: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
tf.Tensor(-568.4739, shape=(), dtype=float32)

# Hello World on TensorFlow

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

2020-07-23 19:55:55.333304: I tensorflow/core/platform/profile_utils/cpu_utils.cc:102] CPU Frequency: 2801850000 Hz
2020-07-23 19:55:55.335406: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7f4b98000b60 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-07-23 19:55:55.335867: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
Hello, TensorFlow World
Matched Content