How To Install python3-distro on CentOS 8

python3-distro is Linux Distribution - a Linux OS platform information API

Introduction

In this tutorial we learn how to install python3-distro on CentOS 8.

What is python3-distro

The distro (for Linux distribution it runs on, such as a reliable machine-readable ID, or version information. It is a renewed alternative implementation for Python’s original platform.linux_distribution function, but it also provides much more functionality. An alternative implementation became necessary because Python 3.5 deprecated this function, and Python 3.7 is expected to remove it altogether. Its predecessor function platform.dist was already deprecated since Python 2.6 and is also expected to be removed in Python 3.7. Still, there are many cases in which access to that information is needed. See Python issue 1322 for more information. Python 3 version.

We can use yum or dnf to install python3-distro on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install python3-distro.

Install python3-distro on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install python3-distro using dnf by running the following command:

sudo dnf -y install python3-distro

Install python3-distro on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install python3-distro using yum by running the following command:

sudo yum -y install python3-distro

How To Uninstall python3-distro on CentOS 8

To uninstall only the python3-distro package we can use the following command:

sudo dnf remove python3-distro

python3-distro Package Contents on CentOS 8

/usr/bin/distro
/usr/lib/python3.6/site-packages/__pycache__/distro.cpython-36.opt-1.pyc
/usr/lib/python3.6/site-packages/__pycache__/distro.cpython-36.pyc
/usr/lib/python3.6/site-packages/distro-1.4.0-py3.6.egg-info
/usr/lib/python3.6/site-packages/distro-1.4.0-py3.6.egg-info/PKG-INFO
/usr/lib/python3.6/site-packages/distro-1.4.0-py3.6.egg-info/SOURCES.txt
/usr/lib/python3.6/site-packages/distro-1.4.0-py3.6.egg-info/dependency_links.txt
/usr/lib/python3.6/site-packages/distro-1.4.0-py3.6.egg-info/entry_points.txt
/usr/lib/python3.6/site-packages/distro-1.4.0-py3.6.egg-info/top_level.txt
/usr/lib/python3.6/site-packages/distro.py
/usr/share/doc/python3-distro
/usr/share/doc/python3-distro/CHANGELOG.md
/usr/share/doc/python3-distro/CONTRIBUTORS.md
/usr/share/doc/python3-distro/README.md
/usr/share/licenses/python3-distro
/usr/share/licenses/python3-distro/LICENSE

References

Summary

In this tutorial we learn how to install python3-distro on CentOS 8 using yum and dnf.