Saturday, July 3, 2021

How To Install Python TensorFlow On Centos 8

How To Install Python TensorFlow On Centos 8

Make sure you have Python 3.5+ installed on your system.

In [ ]:
python --version
Python 3.6.8

Let us first update the system

sudo yum update

Install Tensorflow With Gpu

Install Cuda

In [ ]:
https://developer.download.nvidia.com/compute/cuda/11.0.3/local_installers/cuda-repo-rhel8-11-0-local-11.0.3_450.51.06-1.x86_64.rpm
sudo rpm -i cuda-repo-rhel8-11-0-local-11.0.3_450.51.06-1.x86_64.rpm    
sudo yum -y install cuda

Depending upon where the libraries get installed, you might run in to following error, when you import tensorflow.

Could not load dynamic library 'libcuda.so.1';

Do following...

cp -p /usr/lib64/libcuda.so.1 /usr/lib/

Install libcudart

In [ ]:
wget https://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia/distrib/cauldron/x86_64/media/nonfree/release/nvidia-cuda-toolkit-devel-11.2.0-8.mga8.nonfree.x86_64.rpm
sudo rpm -i nvidia-cuda-toolkit-11.2.0-8.mga8.nonfree.x86_64.rpm
sudo yum  install nvidia-cuda-toolkit

Now let us install tensorflow using pip.

In [ ]:
pip install tensorflow
Test Tensorflow

Launch Ipython or Python shell and try out these commands.

In [ ]:
In [1]: import tensorflow as tf
2021-07-03 21:00:42.953020: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libcudart.so.11.0

In [2]: with tf.compat.v1.Session() as sess:
   ...:         hello = tf.constant('hello world')
   ...:     
(continued...)

from Planet SciPy
read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...