How to upgrade python on Redhat?

P

penglish1

This question applies specifically to RHEL 3.0 (actually Whitebox), but
also generally to Redhat and probably pretty much every distribution
that uses python for distribution-related tasks (configuration
managers, rpm package management, yum, etc).

So I want to upgrade to python 2.4 on Whitebox 3.0. Ideally I would
like python to live in /usr/bin and replace the python 2.2 that ships
with RHEL entirely. This gets pretty infeasable when you consider how
many packages depend on python 2.2:

cd /usr/lib/python2.2/site-packages
rpm -qf * | sort | uniq
alchemist-1.0.27-1
authconfig-4.3.7-1
ethereal-0.10.3-0.30E.1
file Ft is not owned by any package
file _xmlplus is not owned by any package
kudzu-1.1.22.2-1
libuser-0.51.7-1
libxml2-python-2.5.10-6
mod_python-3.0.3-3.ent
newt-0.51.5-1
parted-1.6.3-29
pygtk2-1.99.16-8
pyOpenSSL-0.5.1-8
pyorbit-1.99.3-5
python-2.2.3-5
python-optik-1.4.1-2
pyxf86config-0.3.5-1
redhat-config-printer-gui-0.6.47.3.19-1
rhnlib-1.5-1.1.WB1
rhpl-0.110.4-1
rpm-python-4.2.2-0.14.WB1
up2date-4.3.19-1.WB1

As best I can tell, I have 2 options:

1) Install python 2.4 from source over /usr/bin/python. Rebuild *all*
of the packages listed above from srpms and reinstall them.

2) Give up and install python 2.4 in /usr/local. This leaves me in the
awkward situation of having to ensure that all our in-house scripts,
all the time use /usr/local/bin/python.

I don't suppose there is a simple, rpm package based approach to fixing
this?
 
D

David Fraser

This question applies specifically to RHEL 3.0 (actually Whitebox), but
also generally to Redhat and probably pretty much every distribution
that uses python for distribution-related tasks (configuration
managers, rpm package management, yum, etc).

So I want to upgrade to python 2.4 on Whitebox 3.0. Ideally I would
like python to live in /usr/bin and replace the python 2.2 that ships
with RHEL entirely. This gets pretty infeasable when you consider how
many packages depend on python 2.2:

cd /usr/lib/python2.2/site-packages
rpm -qf * | sort | uniq
alchemist-1.0.27-1
authconfig-4.3.7-1
ethereal-0.10.3-0.30E.1
file Ft is not owned by any package
file _xmlplus is not owned by any package
kudzu-1.1.22.2-1
libuser-0.51.7-1
libxml2-python-2.5.10-6
mod_python-3.0.3-3.ent
newt-0.51.5-1
parted-1.6.3-29
pygtk2-1.99.16-8
pyOpenSSL-0.5.1-8
pyorbit-1.99.3-5
python-2.2.3-5
python-optik-1.4.1-2
pyxf86config-0.3.5-1
redhat-config-printer-gui-0.6.47.3.19-1
rhnlib-1.5-1.1.WB1
rhpl-0.110.4-1
rpm-python-4.2.2-0.14.WB1
up2date-4.3.19-1.WB1

As best I can tell, I have 2 options:

1) Install python 2.4 from source over /usr/bin/python. Rebuild *all*
of the packages listed above from srpms and reinstall them.

2) Give up and install python 2.4 in /usr/local. This leaves me in the
awkward situation of having to ensure that all our in-house scripts,
all the time use /usr/local/bin/python.

I don't suppose there is a simple, rpm package based approach to fixing
this?
The solution is found on the download page, basically you get the
python2.4 rpm and install it alongside your existing python, and run
your in-house scripts with /usr/bin/env python2.4:

# Q) Is it safe to install these RPMs on a Red Hat system? Will they
over-write the system python and cause problems with other Red Hat
applications that expect a different version of Python?
# A) The RPMs that start with "python2.4" are built to not interfere
with the system Python. They install as "/usr/bin/python2.4" and will
not conflict with the system Python unless you are running on a system
that ships the a version of Python which has the same major/minor number.

To invoke the interpreter with these packages, you will explicitly have
to run "python2.4". Note that all Python RPMs provided by Python.org and
Red Hat provide a "/usr/bin/python2.4" (or similar, with major/minor
number), even if they also provide "/usr/bin/python". So, yes, it should
be safe.

Note that you may need to build and install a second copy of any
packages which you need access to with the supplemental version of
Python. You can build packages of these files for the Python 2.4
interpreters for packages which use Distutils, by using the command
"python2.4 setup.py bdist_rpm".
 
P

Paul Boddie

2) Give up and install python 2.4 in /usr/local. This leaves me in the
awkward situation of having to ensure that all our in-house scripts,
all the time use /usr/local/bin/python.

Or, as recommended, use...

#!/usr/bin/env python

....and make sure the scripts are run in an appropriately configured environment.

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top