CentOS 7 and Python 3

September 7, 2019

Over on Twitter, I said:

Today I was unpleasantly reminded that CentOS 7 (still) doesn't ship with any version of Python 3 available. You have to add the EPEL repositories to get Python 3.6.

This came up because of a combination of two things. The first is that we need to set up CentOS 7 to host a piece of commercial software, because CentOS 7 is the most recent Linux release it supports. The second is that an increasing number of our local management tools are now in Python 3 and for various reasons, this particular CentOS 7 machine needs to run them (or at least wants to ) when our existing CentOS 7 machines haven't. The result was that when I set up various pieces of our standard environment on a newly installed CentOS 7 virtual machine, they failed to run because there was no /usr/bin/python3.

At one level this is easily fixed. Adding the EPEL repositories is a straightforward 'yum install epel-release', and after that installing Python 3.6 is 'yum install python36'. You don't get a pip3 with this and I'm not sure how to change that, but for our purposes pip3 isn't necessary; we don't install packages system-wide through PIP under anything except exceptional circumstances.

(The current exceptional circumstances is for Tensorflow on our GPU compute servers. These run Ubuntu 18.04, where pip3 is available more or less standard. If we had general-use CentOS 7 machines it would be an issue, because pip3 is necessary for personal installs of things like the Python LSP server.)

Even having Python 3.6 instead of 3.7 isn't particularly bad right now; our Ubuntu 16.04 machines have Python 3.5.2 and even our 18.04 ones only have 3.6.8. Even not considering CentOS 7, it will be years before we can safely move any of our code past 3.6.8, since some of our 18.04 machines will not be upgraded to 20.04 next year and will probably stay on 18.04 until early 2023 when support starts to run out. This is surprisingly close to the CentOS 7 likely end of life in mid 2024 (which is much closer than I thought before I started writing this entry), so it seems like CentOS 7 only having Python 3.6 is not going to hold our code back very much, if at all.

(Hopefully by 2023 either EPEL will have a more recent version of Python 3 available on CentOS 7 or this commercial software will finally support CentOS 8. I can't blame them for not supporting RHEL 8 just yet, since it's only been out for a relatively short length of time.)

PS: I don't know what the difference is between the epel-release repositories you get by doing it this way and the epel-release-latest repositories you get from following the instructions in the EPEL wiki. The latter repos still don't seem to have Python 3.7, so I'm not worrying about it; I'm not very picky about the specific version of Python 3.6 I get, especially since our code has to run on 3.5 anyway.

Comments on this page:

By Dan at 2019-09-08 03:08:33:

The epel-release-latest-*.rpm URLs on that wiki page are just symlinks pointing to the latest version of the epel-release RPM package. There's no other repo, that just gives you EPEL.

The Python 3 stack in EPEL7 has been carefully packaged to allow it to be upgraded over the lifetime of CentOS7/RHEL7. It had Python 3.4 when EPEL7 first came out and only recently (last year I think) was upgraded to Python 3.6. I expect we'll see Python 3.8 in EPEL7 before it finally goes end-of-life. You can read about the packaging trickery needed to make it work here: https://fedoraproject.org/wiki/User:Bkabrda/EPEL7_Python3

You can get pip from EPEL7 by installing the python36-pip package.

By chipb at 2019-09-08 09:22:53:

The recent RHEL 7.7 feature update apparently adds support for Python 3(.6) to the base distribution: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/7.7_release_notes/new_features#enhancement_compiler-and-tools

It hasn’t percolated into CentOS yet, but projecting out the typical ~1 month rebuild time from the RHEL release on August 6, a non-EPEL python3 package may be showing up Any Day Now.

By rwha at 2019-09-10 07:15:12:
yum install python36-pip

I'm glad you didn't have to experience installing python 3.6 with python 3.4 previously installed (they are both available in epel, each with their own respective versions of third-party packages).

- rwha

By seth at 2019-09-11 09:11:38:

It's not available in the main repos, but there's the rh-python36 software collection (as well as older versions). That's been the official way to get it on centos7 (and rhel7, if you have the right license).

Written on 07 September 2019.
« Programs that let you jump around should copy web browser navigation
Jumping backward and forward in GNU Emacs »

Page tools: View Source, View Normal, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sat Sep 7 23:24:39 2019
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.