View previous topic :: View next topic |
Author |
Message |
dahoste Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 01 Dec 2005 Posts: 138 Location: Maryland, USA
|
Posted: Fri Sep 14, 2007 6:38 am Post subject: How to stay on python2.4, but have python2.5 installed? |
|
|
I need to do some python2.5.* testing, but I don't want to formally transition my server to it. I'd rather stick with python2.4.* for now for everything else (i.e. I want /usr/bin/python to be python2.4).
How do I accomplish this? A lot of the related python modules (like dev-python/imaging) seem to go with whatever latest version of python gets emerged - that is to say that they disappear from the old python and only function for the newest one. So I don't think I can just oneshot python2.5, can I?
I'll be happy if the system is basically unaware that python2.5 exists, but I'm able to run it explicitly by invoking '/usr/bin/python2.5'. But that only seems to work the other way: upgrading python and getting the newer version as default, and being able to explicitly run the older version. I want the opposite.
I'm sorry if there's an obvious solution to this with some emerge voodoo. I'm still a gentoo rookie.
Thanks in advance for any help with this issue. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
boris_qd Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 29 Aug 2005 Posts: 158 Location: Bonn/Germany
|
Posted: Fri Sep 14, 2007 6:50 am Post subject: |
|
|
I'm pretty sure you can do the following (I don't have any problems with this setup)
(1) emerge python 2.5 (but nothing else)
(2) Make your /usr/bin/python* files look like:
Code: |
user@hostname ~ $ ls -alh /usr/bin/python*
lrwxrwxrwx 1 root root 18 Sep 11 19:35 /usr/bin/python -> /usr/bin/python2.4
lrwxrwxrwx 1 root root 17 Sep 11 19:21 /usr/bin/python-config -> python-config-2.4
-rwxr-xr-x 1 root root 179 Sep 11 19:21 /usr/bin/python-config-2.4
lrwxrwxrwx 1 root root 18 Sep 11 19:35 /usr/bin/python2 -> /usr/bin/python2.4
-rwxr-xr-x 1 root root 3.6K Sep 11 19:21 /usr/bin/python2.4
-rwxr-xr-x 1 root root 3.5M Sep 11 12:51 /usr/bin/python2.5
-rwxr-xr-x 1 root root 1.4K Sep 11 12:51 /usr/bin/python2.5-config
|
Calling python invokes python2.4. You can explicitly call python2.5 if you want. The only thing you might have to be careful about is running the same files/scripts from two different pythons - There might be some problem with the precompiled files - but I don't really know and haven't tried that. Of course you can always just rebuild those files to use whatever python you prefer. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dahoste Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 01 Dec 2005 Posts: 138 Location: Maryland, USA
|
Posted: Fri Sep 14, 2007 3:06 pm Post subject: |
|
|
boris_qd,
Ok, I'll try manually adjusting the /usr/bin/python* simlinks back to 2.4. Have you had any trouble with additional python modules? (like dev-python/imaging (PIL), for instance)? I think when I emerge python2.5, if I want 3rd party modules to work I have to emerge them as well (before reverting simlinks to 2.4), and when I do that the modules get removed from the python2.4 lib tree for some reason.
Is there anyway to keep them from getting removed from 2.4 when I install them for 2.5? Or do I need to install them for 2.5, revert the /usr/bin/python simlinks as you described, and then *reinstall* the modules so that they're available again from 2.4?
The fact that they get removed for 2.4 when I install them for 2.5 was surprising to me. I think if I could prevent that from happening, that would be the best scenario.
thanks. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dahoste Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 01 Dec 2005 Posts: 138 Location: Maryland, USA
|
Posted: Sat Sep 15, 2007 5:17 am Post subject: |
|
|
Ok, after some more simple experimenting, I can't figure out how to get python modules to exist simultaneously in both the 2.4 and 2.5 python path.
Things like dev-python/imaging have to be re-emerged before they'll work with 2.5, but in so doing, the emerge process cleans the module out of the 2.4 path. I can fix the /usr/bin/python* links to manually convert back to 2.4, but when I re-merge the modules so that they work with 2.4 again, they get cleaned out of the 2.5 path!
Having 2.4 and 2.5 simultaneously is essentially useless to me if I can't also have 3rd party modules exist for both simultaneously as well.
Is there some lower level emerge option that I can exploit to prevent it from cleaning out the site-packages for python when I emerge a python module?
thanks. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Genone Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/21004157514287ab2b29021.jpg)
Joined: 14 Mar 2003 Posts: 9625 Location: beyond the rim
|
Posted: Sat Sep 15, 2007 11:25 am Post subject: |
|
|
dahoste wrote: | Ok, after some more simple experimenting, I can't figure out how to get python modules to exist simultaneously in both the 2.4 and 2.5 python path.
Things like dev-python/imaging have to be re-emerged before they'll work with 2.5, but in so doing, the emerge process cleans the module out of the 2.4 path. I can fix the /usr/bin/python* links to manually convert back to 2.4, but when I re-merge the modules so that they work with 2.4 again, they get cleaned out of the 2.5 path!
Having 2.4 and 2.5 simultaneously is essentially useless to me if I can't also have 3rd party modules exist for both simultaneously as well.
Is there some lower level emerge option that I can exploit to prevent it from cleaning out the site-packages for python when I emerge a python module?
thanks. |
Well, there is AUTOCLEAN=no, BUT I'd strongly advise to not use it as it's a a) a global flag, so it would affect all packages, b) when you're remerging the same version of those packages the normally unmerged files would be orphaned, c) it puts the installed package DB into an inconsistent state, which can seriously confuse portage.
What you need is a distutils.eclass that will install packages for all python version, someone worked on this a while ago, but no clue about its current state or where it was located. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dahoste Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 01 Dec 2005 Posts: 138 Location: Maryland, USA
|
Posted: Sat Sep 15, 2007 2:22 pm Post subject: |
|
|
Genone, thanks for the reply.
So it seems like I'm pretty much out of luck if I want to actually have 3rd party python modules installed for both python 2.4 and 2.5 simultaneously.
I don't know much about the SLOT mechanism in gentoo, but this seems like the kind of thing that it would address. Slotting a package means having a level of indirection for it so that what would normally be mutually exclusive installations can instead co-exist, with one being considered the 'default' for dependent packages that don't specify a version, and the other remaining available for explicit use.
But in this situation the problem is that dependent packages still see their other installed versions and consider *them* to be mutually exclusive. So the fact that python is slotted only affects emerging python itself.
Oh well, I guess I'll have to look into manually installing the modules for one or the other version of python. I hate stepping outside portage. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dahoste Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 01 Dec 2005 Posts: 138 Location: Maryland, USA
|
Posted: Sun Sep 16, 2007 3:20 pm Post subject: |
|
|
Follow-up question: if I install python 2.5, but I want the system to effectively just stay on 2.4, do I need to do anything other than manually change the /usr/bin/python* links back to 2.4? I.e. - how to I keep 2.5 around just for some testing purposes, but have emerges, etc.. all just stick with 2.4?
thanks. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dahoste Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 01 Dec 2005 Posts: 138 Location: Maryland, USA
|
Posted: Mon Oct 29, 2007 7:17 pm Post subject: |
|
|
On the machine where I was doing this python version testing, I'm now seemingly 'stuck' with python2.5.
How does gentoo determine what version of python is the 'active' or selected version? Is it something more than just the symlinks in /usr/bin?
The situation specifically is that I want to just go back to python2.4.*. Python2.5.* is installed, and that's fine, as long as it just sits there unused unless I invoke it specifically.
When I do 'emerge --pretend python' I get:
Code: | [ebuild R ] dev-lang/python-2.4.4-r6 |
But if I actually do the re-emerge, the resulting log tells me stuff like the following:
Code: | INFO: postinst
Linking /usr/bin/python2.5 to /usr/bin/python (relative)
Linking /usr/bin/python2.5 to /usr/bin/python2 (relative)
Linking /usr/bin/idle2.5 to /usr/bin/idle (relative)
Linking /usr/bin/pydoc2.5 to /usr/bin/pydoc (relative)
Linking /usr/bin/python-config-2.5 to /usr/bin/python-config (relative)
Linking /usr/share/man/man1/python2.5.1.bz2 to /usr/share/man/man1/python.1.bz2 (relative)
Byte compiling python modules for python-2.5 .. ...
Byte compiling python modules for python-2.5 .. ... |
And sure enough -- after the merge all of my /usr/bin symlinks are back pointing to 2.5 even though I had specifically moved them to point at 2.4 prior to the emerge.
What silly obvious thing am I neglecting to do so that I can 'hide' 2.5?
thanks. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Genone Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/21004157514287ab2b29021.jpg)
Joined: 14 Mar 2003 Posts: 9625 Location: beyond the rim
|
Posted: Mon Oct 29, 2007 9:16 pm Post subject: |
|
|
The python ebuild (or rather alternatives.eclass used by it) creates the symlink to the highest version it can find, there isn't much you could do about it other than moving /usr/bin/python2.5 out of the way so it does no longer match /usr/bin/python[0-9].[0-9] |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dahoste Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 01 Dec 2005 Posts: 138 Location: Maryland, USA
|
Posted: Mon Oct 29, 2007 9:30 pm Post subject: |
|
|
Roger that.
Do I have to be careful if I want to unmerge python2.5? Or is there no risk associated with that as long as 2.4 is still there?
thanks. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|