Upgrade Python on CentOS 7

Issues related to applications and software problems
Post Reply
Scrif
Posts: 9
Joined: 2019/01/31 21:23:06

Upgrade Python on CentOS 7

Post by Scrif » 2019/02/01 18:33:36

I require Python version 2.7.9 to run cpAnsible. Currently I have Python 2.7.5 installed. Can I easily upgrade to 2.7.9 or are there any dependencies with 2.7.5 for CentOS?

Thanks

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Upgrade Python on CentOS 7

Post by TrevorH » 2019/02/01 18:44:44

No, you cannot upgrade python as all the Redhat supplied tools including yum depend on the exact version of python shipped with the distro. If you attempt to do so then a system reinstall will be in your near future.

There are several repos that ship parallel installable copies of python but none of them that I know of ship a newer python2 than 2.7.5, they are all python3 which the cpAnsible page says is not acceptable.

Given that RH regularly backport fixes and enhancements to their versions of the packages, it might be worth just trying it on 2.7.5 and see what happens.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

pjsr2
Posts: 614
Joined: 2014/03/27 20:11:07

Re: Upgrade Python on CentOS 7

Post by pjsr2 » 2019/02/01 19:01:11

The yum package installer and other system tools depend on python, so NEVER REMOVE OR REPLACE the python-2.7.5 packages.

I would expect that cpAnsible is happy with the python version installed in CentOS 7, as they mention on their site that it is compatible with CentOS-7. As TrevorH already mentions, try that first.

If you run into problems, then you can try to install Python-2.7.13 from the Software Collections. The Software Collections provide packages that can be installed in parallel to the versions that are normally provided in CentOS. See https://wiki.centos.org/AdditionalResou ... tories/SCL

Scrif
Posts: 9
Joined: 2019/01/31 21:23:06

Re: Upgrade Python on CentOS 7

Post by Scrif » 2019/02/01 22:52:44

Thanks for the replies/suggestions. I'll try with the current version of Python installed on CentOS 7 and report back what I discover. Much appreciated.

Mike_Rochefort
Posts: 215
Joined: 2016/03/16 02:34:19

Re: Upgrade Python on CentOS 7

Post by Mike_Rochefort » 2019/02/06 20:04:46

Not sure which specific parts of 2.7.9 cpAnsible relies on, but the 2.7.5 branch of RHEL python is not the same as base 2.7.5 as Trevor noted. If it has anything to do with the pip/TLS fixes for PyPI and other SSL requirements, those patches have already been applied.

If you absolutely need another Python version:

EPEL: 3.4, 3.5, 3.6
PyEnv: Literally everything, including patch point releases.
Build from Source into a custom directory (use PyEnv instead).

Cheers,
Mike
Solution Architect @RedHat | RHCE
Former SysAdmin @BlueSkyStudios and @Pixar
Feature animation and VFX enthusiast
--
Report CentOS Stream 8 bugs: https://da.gd/c8s-bugs
Report CentOS Stream 9 bugs: https://da.gd/c9s-bugs

noydarly
Posts: 1
Joined: 2019/02/12 18:06:25

Re: Upgrade Python on CentOS 7

Post by noydarly » 2019/02/12 18:10:09

How can I upgrade Python 2.7 to 3.6?
I want to completely remove the 2.7 and reinstall 3.6

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Upgrade Python on CentOS 7

Post by TrevorH » 2019/02/12 19:34:27

Perhaps you should actually read the thread that you just hijacked. All the answers are present above.

TL;DR - do not try to overwrite or remove the system python unless you want to reinstall your system.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply