2019-09-07
CentOS 7 and Python 3
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.