running rust python

If you’re interested in Rust and Python like I am, then you may reach a point where the two combine. In this instance I wanted to see if anyone was attempting to implement the Python language interpreter in Rust, and after a quick search, I found the project RustPython on Github ( ).

I cloned a local copy of the source to my Windows 10 Pro itty bitty computer (a Minis Forum UM250 with an AMD Ryzen 5 quad-core CPU, 16GiB, 512GiB SSD). I also have Rust 1.55.0, the current latest release, installed. I followed the directions on the README and it compiled without errors. Unfortunately when it tried to execute it crashed out complaining it couldn’t find ‘encodings,’ and did I have RUSTPYTHONPATH defined. The RUSTPYTHONPATH message stopped me for a moment, as there was nothing in the readme about it. A quick search on Google found the solution.

So, here’s what I’ve discovered so far on Windows 10:

  • You need to set $RUSTPYTHONPATH to the full path to the project’s Lib directory. On my machine I do all my work in C:\Develop, and I have cloned Rust Python into C:\Develop\Rust\RustPython. The Lib folder is thus C:\Develop\Rust\RustPython\Lib, and I execute $env:RUSTPYTHONPATH=C:\Develop\Rust\RustPython\Lib. A quick alternative is to cd into the Lib folder and execute $env:RUSTPYTHONPATH=$PWD from the command line if all you want to do is test within that window.
  • The README says to execute cargo with the release flag to avoid crashing out due to stack overflow. You don’t need to do that anymore. I accidentally forgot to include the release flag in one run, and Rust dutifully built the debug version and ran it without incident.

I’m very impressed with this Rust implementation of Python. I’m no Python expert, but it has so far run a number of my scripts correctly. I am trying to determine how I might meaningfully contribute to the project. I doubt I could write decent Rust source for them, so I may just be on the sidelines watching. I just hope that this project continues on and doesn’t die a slow death like many other past open source projects that showed promise.

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 –