views:

946

answers:

3

Fedora Core 9 includes Python 2.5.1. I can use YUM to get latest and greatest releases.

To get ready for 2.6 official testing, I wanted to start with 2.5.4. It appears that there's no Fedora 9 YUM package, because 2.5.4 isn't an official part of FC9.

I downloaded 2.5.4, did ./configure; make; make install and wound up with two Pythons. The official 2.5.1 (in /usr/bin) and the new 2.5.4. (in /usr/local/bin).

None of my technology stack is installed in /usr/local/lib/python2.5.

It appears that I have several choices for going forward. Anyone have any preferences?

  • Copy /usr/lib/python2.5/* to /usr/local/lib/python2.5 to replicate my environment. This should work, unless some part of the Python libraries have /usr/bin/python wired in during installation. This is sure simple, but is there a down side?

  • Reinstall everything by running easy_install. Except, easy_install is (currently) hard-wired to /usr/bin/python. So, I'd have to fix easy_install first, then reinstall everything.

    This takes some time, but it gives me a clean, new latest-and-greatest environment. But is there a down-side? [And why does easy_install hard-wire itself?]

  • Relink /usr/bin/python to be /usr/local/bin/python. I'd still have to copy or reinstall the library, so I don't think this does me any good. [It would make easy_install work; but so would editing /usr/bin/easy_install.]

Has anyone copied their library? Is it that simple?

Or should I fix easy_install and simply step through the installation guide and build a new, clean, latest-and-greatest?


Edit

Or, should I

  • Skip trying to resolve the 2.5.1 and 2.5.4 issues and just jump straight to 2.6?
A: 

I suggest you create a virtualenv (or several) for installing packages into.

codeape
+1  A: 

I've had similar experiences and issues when installing Python 2.5 on an older release of ubuntu that supplied 2.4 out of the box.

I first tried to patch easy_install, but this led to problems with anything that wanted to use the os-supplied version of python. I was often fiddling with the tool chain to fix different errors that might crop up with every install. Installing any python software via apt, or installing any software from apt that had a python easy_install script as part of the install, was often amusing. I'm sure I could probably have been more vigilant in patching easy_install, but I gave up.

Instead, I copied the library, and everything worked. As you say, there may be issues depending on what you have installed, but I didn't run into issues. Double-checking Python's site.py module, I did see that it operates entirely on relative paths, building absolute paths dynamically; this gave me some confidence to try the "copy everything" approach. I double-checked any .pth files, then went for it.

Jarret Hardie
+3  A: 

Normally, you would only have one version of a python release installed. Since 2.5.1 and 2.5.4 are from the same release, copying your libraries should work fine. What you would need to watch out for, is that you now have /usr/bin/python, and /usr/local/bin/python in your path, and some utilities may get confused.

If you need to have both micro-releases installed at once, I would keep 2.5.4 out of your path altogether, or allow it to completely clobber the other (do so at your own risk though ;) If you go with the former, you can also point 2.5.4 to your site-packages by using the PYTHONPATH environment variable.

Ubuntu takes a different route, and this is how you can handle different major releases. The python binary is given with the version appended:

/usr/bin/python -> python2.6
/usr/bin/python2.5
/usr/bin/python2.6

Each has their own /usr/lib/python2.X directory with versions of all the modules.

And lastly, you can further customize your setup by modifying your site.py

JimB