building python 3.9.5 on almalinux 8.3 (purple manul)

Alma Linux (or if you prefer, AlmaLinux) is essentially CentOS with a new coat of paint. IBM, owner of RedHat, who in turn owns CentOS, stirred up a hornet’s nest back in December 2020 when the owners announced that CentOS 8 was changing from a stable release of RHEL 8 to a rolling release of RHEL, and renaming it CentOS Stream. CentOS 8 is being end-of-lifed December of this year, 2021. Needless to say, there are a lot of unhappy CentOS users looking for an alternative.

AlmaLinux ( ) might be one of those alternatives. Originally created by CloudLinux Inc ( ) as a fork of their Linux distribution CloudLinux OS, Alma Linux is “an open-source, community-driven project that intends to fill the gap left by the demise of the CentOS stable release. AlmaLinux OS is a 1:1 binary compatible fork of RHEL® 8 guided and built by the community. As a standalone, completely free OS, AlmaLinux OS enjoys $1M in annual sponsorship from CloudLinux Inc and support from other sponsors. Ongoing development efforts are governed by the members of the community.” To help allay any fears that Alma/Cloud isn’t mature enough, CloudLinux OS “is a RHEL fork that has been in place for over ten years.”

I’ve downloaded the AlmaLinux ISO and created a VM under Parallels Desktop, and so far it behaves just like CentOS, at least for me. What AlmaLinux lacked was an up-to-date version of Python, so I set about building an alternative installation of Python 3.9.5, the current (as of this posting date) Python release.


Like every other RHEL 8 and its clones, the base OS isn’t set up to successfully build all of Python, including many of its modules. So the first thing you have to do is install all the various support libraries and several applications that Python needs to build.

Let’s start by installing the following list of libraries. These match what I’ve documented in the past for Ubuntu, except that the package names are different for RHEL/AlmaLinux.

sudo dnf install zlib-devel ncurses-devel gdbm-devel nss-devel openssl-devel readline-devel libffi-devel sqlite-devel bzip2-devel

Next install Tk. This will also pick up Tcl, the dependency.

sudo dnf install tk tk-devel

Install these last bits for some obscure libraries.

sudo dnf install lzma xz-devel

Because I’m also working with PyQt6, I need to install the full Qt tool set. This won’t stop Python from building, but after installing Python 3.9.5 and installing PyQt6, any PyQt code you write won’t run. You need this package for the PyQt6 runtime.

sudo dnf install qt qt5-qtbase-devel


Download the Python source and untar it into some area on your system. In the same folder where you untarred the source, create a build directory, such as build-3.9.5, and change directory (cd) into it. Then run the following to configure the build environment.

../Python-3.9.5/configure --enable-optimizations

When finished, run make, then make altinstall where your new Python will be located in /usr/local/bin.

Install and Test

You’ll need to add /usr/local/bin to your path in your .bashrc. Bring up a new shell, or source ~/.bashrc in your current shell, and you should be able to test Python, python3.9 --version.


Red Hat resets CentOS Linux and users are angry –

and, of course, some cat photos

Beau sneaking a peak
Beau sneaking a peak

There was an article recently written how cats love their squares (see , for example). Beau and the rest of our cats are no exception to this observation (‘If I fits, I sits’). In this specific example Beau is inside one of the outdoor tables, busily looking around.

Joan in the shade
Joan in the shade

Taken outside in the warm Florida day, Joan Jett is underneath one of the whicker furniture seats to get out of the direct sun. Our cats love the warmth, but not the direct sunshine.

Danï big girl
Danï big girl

This photo shows how much Lil’ Danï has grown in a little more than one year. She’s still small sitting next to one of the Gingersnaps, but not that much smaller. She’s growing into her many, many extra toes.