4

I have CentOS 7, Is there any option how to install python 3.8 on CentOS 7 ? Looks that no pkg found in all repos. So only option is to compile from source ? Why is not supported in EPEL... ?

yum install python38
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: bay.uchicago.edu
 * centos-sclo-rh: centos-distro.1gservers.com
 * epel: fedora.westmancom.com
 * extras: abqix.mm.fcix.net
 * updates: centos.mirrors.hoobly.com
No package python38 available.
andrew
  • 231
  • centos 7 is dead... upgrade ;) – djdomi Oct 26 '22 at 19:43
  • 1
    OK, I was thinking that END is (30 Jun 2024) – andrew Oct 27 '22 at 10:45
  • Although the last security update has not yet been released for CentOS 7, that does not mean its software is getting new versions. A Python 3 had to happen during 7's lifecycle, but they locked the version in the base OS repo. See my answer for an alternative. – John Mahowald Oct 29 '22 at 17:21

1 Answers1

6

When a package's exact name is not known (python3, python38, something scl) file name searches can do a more complete search: yum provides '*bin/python3*'

Correct, there is no python3.8 in EPEL 7. There is a python3.6 in EL 7, and EPEL policy is not to replace EL packages. Plus the distro's policy to avoid major upgrades, would seem like it is stuck on older Python.

Your yum repo list hints that CentOS software collections are enabled, which could be an alternative.

yum install centos-release-scl-rh
yum install rh-python38-python

Note both the package name and the files are prefixed, which allows coexistence with other pythons. While perhaps SCL is not the most popular packaging convention, it is already built and public, an advantage over your own source builds.

Currently CentOS 7 is 87 weeks from end of life, which is not a lot by EL time scales. Most of the maintainer attention is on EL 8 and 9, 7 is critical fixes only.

Budget some of that time to figure out what you are are going to do post CentOS 7. Which may be non-trivial, as CentOS 8 is dead, and if Stream is not what you need, may be switching distros.

John Mahowald
  • 33,256
  • 2
  • 21
  • 39
  • it's as always, keep your stuff in the mainstream support, not on the extended. That's why you should consider to upgrade and think about why imho is 7 dead – djdomi Oct 29 '22 at 16:18
  • Thanks! To get requests working on centos7 I also had to: PATH=${PATH}:/opt/rh/rh-python38/root/usr/bin/ && yum install -y rh-python38-python-pip openssl && python3 -m pip install requests && python3 -m pip install "urllib3 <=1.26.15" – jamshid Jul 18 '23 at 00:31
  • And remember python 3.8 itself is EOL 2024-10 (https://devguide.python.org/versions/), a few months after centos 7's 2024-06 EOL. Rockylinux and Centos 8 Stream have python39 which is EOL 2025-10. Note Centos 8 Stream's EOL is 2024-05 after which you must switch to rockylinux:8 or Centos 9 Stream (https://wiki.centos.org/About/Product). – jamshid Jul 18 '23 at 02:05
  • Worked for me. Thanks. – Sinan Eldem Dec 27 '23 at 02:18