CentOS Stream 10

TensorFlow : Install2025/10/02

 

Install TensorFlow which is the Machine Learning Library.
On this example, Setup TensorFlow to use NVIDIA GPU on your computer.

[1]

Install CUDA, refer to here.

[2]

Install Python 3, refer to here.

[3] Install required packages.
[root@dlp ~]#
dnf -y install cudnn9-cuda-13 python3-devel gcc gcc-c++ make cuda-cudart-13-0
[4] 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 [5] with root user account.
[cent@dlp ~]$
python3 -m venv --system-site-packages ~/tensorflow

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

(tensorflow) [cent@dlp ~]$
[5] Install TensorFlow.
(tensorflow) [cent@dlp ~]$
pip3 install --upgrade tensorflow[and-cuda]
# verify to run TensorFlow

(tensorflow) [cent@dlp ~]$
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

2025-10-01 17:38:44.152506: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]

(tensorflow) [cent@dlp ~]$
python3 -c "from tensorflow.python.client import device_lib; device_lib.list_local_devices()"

2025-10-01 17:38:53.088757: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1759307935.375194    3728 gpu_device.cc:2020] Created device /device:GPU:0 with 10260 MB memory:  -> device: 0, name: NVIDIA GeForce RTX 3060, pci bus id: 0000:07:00.0, compute capability: 8.6
Matched Content