Installing Python 2.4 on Linux

E

Edward Diener

I can install Python 2.4 on the Fedora 3 Linux system, but after I do a
number of Linux utilities and commands, like yum, stop working because
they were dependent on the Python 2.3 installation. What happens is that
Python 2.4 replaces the /usr/bin/python module with the Python 2.4
version. If I replace /usr/bin/python with the Python 2.3 version
executable, which is still on my system, that all the aforesaid modules
depend on, they start working again, but I can no longer execute
modules, like IDLE, which was part of my Python 2.4 distribution.

What is the solution to this ? The operating system was installed with
Python 2.3 and the development libraries but no tools, doc, or
otherwise. I have installed Python 2.4 with all the RPMs and copied down
the Python 2.4 documentation to my machine ( since python24-docs.rpm
gives one very little ). I would naturally like to use Python 2.4
without killing all the commands that depend on Python 2.3. No doubt
these commands have their modules in the site libraries for Python 2.3.
Of course I would love to update these dependencies to use Python 2.4
but newer RPMs for these commands do not exist.

I do not know whether this is a Python problem or a Fedora 3 problem but
I thought I would ask here first and see if anybody else had the same
problem. I imagine the problem might exist on other Linux systems.
 
?

=?iso-8859-2?q?Marcin_St=EApnicki?=

Dnia Tue, 05 Apr 2005 21:21:37 +0000, Edward Diener napisal(a):
I can install Python 2.4 on the Fedora 3 Linux system, but after I do a
number of Linux utilities and commands, like yum, stop working because
they were dependent on the Python 2.3 installation. What happens is that
Python 2.4 replaces the /usr/bin/python module with the Python 2.4
version. If I replace /usr/bin/python with the Python 2.3 version
executable, which is still on my system, that all the aforesaid modules
depend on, they start working again, but I can no longer execute
modules, like IDLE, which was part of my Python 2.4 distribution.

What is the solution to this ? The operating system was installed with
Python 2.3 and the development libraries but no tools, doc, or
otherwise. I have installed Python 2.4 with all the RPMs and copied down
the Python 2.4 documentation to my machine ( since python24-docs.rpm
gives one very little ). I would naturally like to use Python 2.4
without killing all the commands that depend on Python 2.3. No doubt
these commands have their modules in the site libraries for Python 2.3.
Of course I would love to update these dependencies to use Python 2.4
but newer RPMs for these commands do not exist.

I do not know whether this is a Python problem or a Fedora 3 problem but
I thought I would ask here first and see if anybody else had the same
problem. I imagine the problem might exist on other Linux systems.

It's rather Fedora related, I have Python 2.2, 2.3 and 2.4 on my Ubuntu
box and they seem to coexist without problems.

If you can afford breaking package dependencies a bit, save a copy of
python2.3 binary somewhere and recreate it after installing Python 2.4,
OR make a symbolic link /usr/bin/python to /usr/bin/python2.3 and use
/usr/bin/python2.4 explicitely when you want to use the newer version. You
may also try to link modules from /usr/lib/python2.3/site-packages to
/usr/lib/python2.4/site-packages (all or just few of them) - most should
be upwards compatible. It may make Fedora utilities work again
(you haven't provided error messages, so it's hard to tell) even with
Python 2.4.
 
E

Edward Diener

Marcin said:
Dnia Tue, 05 Apr 2005 21:21:37 +0000, Edward Diener napisal(a):


It's rather Fedora related, I have Python 2.2, 2.3 and 2.4 on my
Ubuntu box and they seem to coexist without problems.

If you can afford breaking package dependencies a bit, save a copy of
python2.3 binary somewhere and recreate it after installing Python
2.4

After I installed Python 2.4, the Python 2.3 executable still existed on the
system. So the only difference which occurred is that the Python 2.4
installation copied to the /usr/bin/python executable the /usr/bin/python2.4
executable ( it would seem more understandable that /usr/bin/python be a
link instead ). So there is really no need to recreate it. Essentially the
two versions co-exist on the system but only one can be /usr/bin/python and
therefore executed when a Python script is is used as a command.
, OR make a symbolic link /usr/bin/python to /usr/bin/python2.3
and use /usr/bin/python2.4 explicitely when you want to use the newer
version.

Yes, this is the right solution. I am so used to just executing a Python
script that I forgot that I could just say 'python2.4 ascript.py'.
You may also try to link modules from
/usr/lib/python2.3/site-packages to /usr/lib/python2.4/site-packages
(all or just few of them) - most should be upwards compatible.

By link do you simply mean moving the unique modules in the site packages
from the python2.3 directory to the python2.4 site-packages directory, or is
there something else I must do to see if they work ?
It may
make Fedora utilities work again (you haven't provided error
messages, so it's hard to tell) even with Python 2.4.

The errors when executed from the command line, when python2.4 is python,
involved not being able to find modules, no doubt because they were not in
the python2.4 site-packages subdirectory. When python2.3 is python, the
modules are found and everything works. Maybe it is just a matter of moving
of copying these modules on over and seeing if that fixes things. Do
site-packages have to "register" themselves in any way during setup ? I do
not think so, but I may be wrong.
 
S

Simon John

Marcin said:
It's rather Fedora related, I have Python 2.2, 2.3 and 2.4 on my Ubuntu
box and they seem to coexist without problems.

It's not a Fedora problem at all.

The 2.4.1 RPM's just move the default /usr/bin/python symlink to point
to the new Python24 instead of Python23 that is the system default. You
can move it back and then just point to it in the shebang in your
scripts (#!/usr/bin/python24)

Or you could compile 2.4 from source as I did, then you won't need to
change symlinks, just install it in /usr/local/bin/python24 or
something. I prefer this method, as it means you can have a seperate
2.4 install of wxPython etc (just change the LD_LIBRARY_PATH).
 
D

David Fraser

Edward said:
I can install Python 2.4 on the Fedora 3 Linux system, but after I do a
number of Linux utilities and commands, like yum, stop working because
they were dependent on the Python 2.3 installation. What happens is that
Python 2.4 replaces the /usr/bin/python module with the Python 2.4
version. If I replace /usr/bin/python with the Python 2.3 version
executable, which is still on my system, that all the aforesaid modules
depend on, they start working again, but I can no longer execute
modules, like IDLE, which was part of my Python 2.4 distribution.

What is the solution to this ? The operating system was installed with
Python 2.3 and the development libraries but no tools, doc, or
otherwise. I have installed Python 2.4 with all the RPMs and copied down
the Python 2.4 documentation to my machine ( since python24-docs.rpm
gives one very little ). I would naturally like to use Python 2.4
without killing all the commands that depend on Python 2.3. No doubt
these commands have their modules in the site libraries for Python 2.3.
Of course I would love to update these dependencies to use Python 2.4
but newer RPMs for these commands do not exist.

I do not know whether this is a Python problem or a Fedora 3 problem but
I thought I would ask here first and see if anybody else had the same
problem. I imagine the problem might exist on other Linux systems.

Actually the Fedora RPMS supplied on the Python website are fine:
http://www.python.org/2.4.1/rpms.html
Quoting from that page:
# 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".

This is by far the preferred way to install a different version of
Python to the default version provided with a distribution, as you don't
then conflict with packages that require the default version.

Also, it is better to do it like this using real packages than to rename
files manually. I have used the above successfully on Fedora Core 3 (and
other similar versions on other distro versions), if it doesn't work for
you there is a source RPM available to rebuild from

Hope that helps
David
 
J

Joseph Garvin

Another solution is to just install 2.4 and then make an alias for
yum='/usr/bin/python2.3 yum' or whatever the path is :)
 
E

Edward Diener

David said:
Actually the Fedora RPMS supplied on the Python website are fine:
http://www.python.org/2.4.1/rpms.html
Quoting from that page:



This is by far the preferred way to install a different version of
Python to the default version provided with a distribution, as you don't
then conflict with packages that require the default version.

I do have a separate package installed for Python2.4 and it coexists
with Python2.3. The real problem is that a great number of other
packages, which are initially part of the system, depend on Python2.3 so
I must leave /usr/bin/python as Python2.3. I do not know of a way to
reinstall these other packages to use Python2.4 instead. Does the line
above, "python2.4 setup.py bdist_rpm" mean that I am supposed to run
this against each of these other package's rpm files and substitute for
"bdist_rpm" the name of the rpm file ?
Also, it is better to do it like this using real packages than to rename
files manually. I have used the above successfully on Fedora Core 3 (and
other similar versions on other distro versions), if it doesn't work for
you there is a source RPM available to rebuild from

Is "bdist_rpm" the source rpm for these packages which currently depend
on Python2.3 ?

Further help getting my Fedora 3 packages which depend on Python2.3 to
use Python2.4 would be appreciated.
 
E

Edward Diener

Joseph said:
Another solution is to just install 2.4 and then make an alias for
yum='/usr/bin/python2.3 yum' or whatever the path is :)

If it were just 'yum' under Fedora 3, I could probably do that but
looking at the dependencies on the python2.3 package in Synaptic there
must be about 50 other packages mentioned. Which one of these
specifically use python2.3 to execute their .py scripts and which ones
just use python2.3 shared libraries is another matter which will take
much work to discover. But thanks for your suggestion nonetheless.
 

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,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top