View previous topic :: View next topic |
Author |
Message |
Helena Veteran
Joined: 02 Apr 2003 Posts: 1114 Location: Den Dolder, The Netherlands
|
Posted: Fri Mar 25, 2011 9:45 am Post subject: How to upgrade Python 2.6 to 2.7 |
|
|
EDIT revised to quickly display the solution without having to search the entire topic
In the stable tree python 2.7 has been available for some time. However the upgrade from 2.6 needs to be performed in a certain manner.
Immediately after emerging python 2.7 a message is displayed by portage about running python-updater. This message does not list all steps required which are: Code: | eselect python set python2.7
python-updater
emerge --depclean
revdep-rebuild | NOTE of course the last two lines may affect other packages as well!
Below is the rest of my original post....
- First: why is it necessary? I always upgrade to the latest version but this one doesn't seem to offer any improvements and does cost a lot of effort (see below).
- Second: how to perform the upgrade? the ebuild only mentions python-updater but forgets to mention the necessary eselect-command.
- Third: what happens during the upgrade? I have to rebuild almost 60 packages, a lot of them Gnome-related. On an older Athlon-based system this can take a couple of hours (in fact 160 min...).
Mod Edit: stuck - tomk
Unstuck. -- desultory
Last edited by Helena on Thu Apr 28, 2011 5:01 pm; edited 3 times in total |
|
Back to top |
|
|
mikegpitt Advocate
Joined: 22 May 2004 Posts: 3224
|
Posted: Fri Mar 25, 2011 7:28 pm Post subject: Re: Python 2.7 upgrade? |
|
|
Helena wrote: | In the stable tree python 2.7 has been available for some time. |
I wouldn't really use the term "some time"... it looks like it just went stable yesterday for some archs, and many more are still marked unstable.
Helena wrote: | - First: why is it necessary? I always upgrade to the latest version but this one doesn't seem to offer any improvements and does cost a lot of effort (see below).
| You aren't forced to update python or switch to the new version, but eventually ebuilds will depend on this version. Once it is marked as stable, it will likely be the default for testing, and when that happens, usually the dependencies will reflect the software versions the devs used to test.
Helena wrote: | Second: how to perform the upgrade? the ebuild only mentions python-updater but forgets to mention the necessary eselect-command. | Usually all you need to do is python-updater... If I remember correctly sometimes the ebuild will handle the eselect. If you want to make sure, run eselect to change to the 2.7 branch then run python-updater.
Helena wrote: | Third: what happens during the upgrade? I have to rebuild almost 60 packages, a lot of them Gnome-related. On an older Athlon-based system this can take a couple of hours (in fact 160 min...).
| This is necessary and optional all at the same time. I say necessary since it will point your binaries to use the new python version, but optional since the dependencies will continue to work fine pointing to the old python (unless you decide to remove it from your system). Using python-updater should be really simple and automatic for most people... just type the command and sit back. |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6103 Location: Dallas area
|
Posted: Fri Mar 25, 2011 7:39 pm Post subject: |
|
|
steps to the upgrade
1. emerge python
2. eselect python list
3. eselect python set <whatever 2.7 is>
4. python-upgrade (may take awhile, depending on how many pkgs you have that use it - 59 for me)
5. (optional) emerge --depclean python (to get rid of old python, I always run with -p to see what it will do first) _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
thumper Guru
Joined: 06 Dec 2002 Posts: 552 Location: Venice FL
|
Posted: Fri Mar 25, 2011 7:52 pm Post subject: |
|
|
And it all seems to go sideways, check you make.conf and be sure you don't have this haunting you:
if you do, you can adjust accordingly.
George |
|
Back to top |
|
|
ferreirafm Guru
Joined: 28 Jul 2005 Posts: 487 Location: Sao Paulo, Brazil
|
Posted: Fri Mar 25, 2011 8:14 pm Post subject: |
|
|
Hi Helena,
When updating python the emerge is going to remove the version 2.6. So you need to eselect the new pyhton version just installed.
Otherwise, I can't be able to run the python-update. Have a look on this thread
G'Luck |
|
Back to top |
|
|
keenblade Veteran
Joined: 03 Oct 2004 Posts: 1087
|
Posted: Fri Mar 25, 2011 11:38 pm Post subject: |
|
|
ferreirafm wrote: | Hi Helena,
When updating python the emerge is going to remove the version 2.6. ... |
No, portage won't remove v2.6. It wil install v2.7 into another slot. And for me, python-updater needed a patch from g.b.o to perform the update. Because python-updater stopped with an error without updating the list it created. Maybe the patch is already appled. Don't know. _________________ Anyway it's all the same at the end...
Need help to get it working: "x-fi surround 5.1" |
|
Back to top |
|
|
TiccTech n00b
Joined: 13 Jun 2004 Posts: 42 Location: Oregon, US
|
Posted: Sat Mar 26, 2011 12:16 am Post subject: |
|
|
Quote: | No, portage won't remove v2.6. It wil install v2.7 into another slot. |
True. However, if you do then run python-updater as instructed by the ebuild, and then run emerge --depclean as instructed by portage, portage does indeed remove Python 2.6.
And then anything that uses Python doesn't work. Like portage. The ebuild probably should have said to eselect the new Python version before running python-updater. If you, like me, find yourself in this situation, the fix seems to be to eselect Python 2.7, then run python-updater again and let it rebuild a whole bunch of stuff.
-TiccTech |
|
Back to top |
|
|
Helena Veteran
Joined: 02 Apr 2003 Posts: 1114 Location: Den Dolder, The Netherlands
|
Posted: Sat Mar 26, 2011 10:12 am Post subject: |
|
|
I would suggest the developers to update the ebuild message to mention the following commands: Code: | eselect python set python2.7
python-updater | The other suggestions such as the make.conf USE variable may be relevant to a few users; I didn't know it existed anyway. Also since 2.6 and 2.7 exist in different slots general package maintenance applies; imho this need not be mentioned. A warning that running python-updater is really necessary before removing 2.6 could also be useful; I've been struck by this problem too and portage will stop working if you do. |
|
Back to top |
|
|
hujuice Guru
Joined: 16 Oct 2007 Posts: 336 Location: Rome, Italy
|
Posted: Sat Mar 26, 2011 1:23 pm Post subject: |
|
|
What goes wrong is this simple sequence:
Code: | #emerge -uND world
emerge --depclean
revdep-rebuild |
As told before, the depclean will suggest to remove dev-lang/python:2.6 and, as told, the ebuild messages didn't say anything about (I believe so: am I wrong?).
Wise people (me ) could think that rising from 2.6 to 2.7 will be painless.
The correct steps are already mentioned:
Code: | #emerge -uND world
eselect python list
eselect python set N
python-updater
emerge --depclean
revdep-rebuild |
(N corresponding to 2.7)
If you fall down in the wrong case, it's easy to repair.
Code: | emerge --oneshot dev-lang/python:2.6
eselect python set N
python-updater
emerge --unmerge dev-lang/python:2.6
revdep-rebuild |
(N corresponding to 2.7)
I agree: ebuild messages should advise better, with a yellow warning message.
Regards,
HUjuice _________________ Who hasn't a spine, should have a method.
Chi non ha carattere, deve pur avere un metodo. |
|
Back to top |
|
|
albright Advocate
Joined: 16 Nov 2003 Posts: 2588 Location: Near Toronto
|
Posted: Sat Mar 26, 2011 1:57 pm Post subject: |
|
|
sorry to be so blunt, but I've been bitten before with these
kind of "upgrades"
I have *three* versions of python on my sytem at the
moment, all marked stable: 2.6, 2.7 and 3.1
I'd like to have just one (just for the sake of "elegance"
and simplicity).
Is it perfectly safe to eselect python X (which X?) and
run python-updater and trash the other two versions
of python?
Thanks for any advice. _________________ .... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme) |
|
Back to top |
|
|
hujuice Guru
Joined: 16 Oct 2007 Posts: 336 Location: Rome, Italy
|
Posted: Sat Mar 26, 2011 2:21 pm Post subject: |
|
|
I've three version too.
Code: | # eselect python list
Available Python interpreters:
[1] python2.6
[2] python2.7 *
[3] python3.1 |
I believe that your case is similar.
You can select the "active" one by your choice:
Code: | eselect python set X |
where X is the number listed before.
In my case:
Code: | # eselect python set 2 |
For python 2.7 (it's already done, so the star).
This is the usual eselect Gentoo gymnastics (try 'eselect modules list').
About the three versions... the answer is here:
Code: | # equery depends dev-lang/python:2.6
# equery depends dev-lang/python:2.7
# equery depends dev-lang/python:3.1 |
where each command will show the dependencies.
I'm pretty "sure" (never by dogma , equery knows...) that you can remove the 2.6 version, after the python-updater task.
(I'm python-updating right now.)
Regards,
HUjuice _________________ Who hasn't a spine, should have a method.
Chi non ha carattere, deve pur avere un metodo. |
|
Back to top |
|
|
mikegpitt Advocate
Joined: 22 May 2004 Posts: 3224
|
Posted: Sat Mar 26, 2011 3:23 pm Post subject: |
|
|
Python 2.6 can probably go after the update to 2.7, but you should verify that there are no ebuilds depending on 2.6 (with equery or depclean) before you remove it... and after you've done a python-updater.
You should have at least one 2.x branch and one 3.x branch right now. Don't use eselect to migrate to the 3.x branch, since a lot of tools (like portage) still want 2.x. |
|
Back to top |
|
|
Dont Panic Guru
Joined: 20 Jun 2007 Posts: 322 Location: SouthEast U.S.A.
|
Posted: Sat Mar 26, 2011 7:59 pm Post subject: |
|
|
Is it mandatory now to have a USE_PYTHON="2.7" line in your make.conf?
I've been having troubles working through the upgrade to python:2.7. Something keeps reverting my selected python version back to python:2.6. I thought I was going crazy at first, but I reviewed my bash history just to make sure I didn't accidentally do it myself.
I also have a few packages that are installing to python:2.6 even when python:2.7 is correctly eselected (such as app-emulation/emul-linux-x86-baselibs and sys-libs/tdb). |
|
Back to top |
|
|
Helena Veteran
Joined: 02 Apr 2003 Posts: 1114 Location: Den Dolder, The Netherlands
|
Posted: Sat Mar 26, 2011 9:04 pm Post subject: |
|
|
Dont Panic wrote: | Is it mandatory now to have a USE_PYTHON="2.7" line in your make.conf? | I never used this variable and in my opinion it is necessary at all, so my advice is to leave it out completely. I found a relevant (gentoo dev's?) blog: Quote: | When installing [...] with no USE_PYTHON line in /etc/make.conf by default you will get files for the active version of Python 2.x and Python 3.x. | Also you need only one 2.x python version mikegpitt wrote: | Python 2.6 can probably go after the update to 2.7, but you should verify that there are no ebuilds depending on 2.6 (with equery or depclean) before you remove it... and after you've done a python-updater. | Correct, I performed the cleaning steps as described before (emerge --depclean && revdep-rebuild) but only after the 2.7 upgrade steps shown earlier, and python2.6 is gracefully removed. hujuice wrote: | About the three versions... the answer is here:
Code:
# equery depends dev-lang/python:2.6
# equery depends dev-lang/python:2.7
# equery depends dev-lang/python:3.1
where each command will show the dependencies. | A new but possibly interesting feature of gentoolkit, however its output is a little hard to interpret. I also would expect python-updater to take care of everything without me having to check further!
So, to summarize, the only steps needed are, to my best belief Code: | eselect python set python2.7
python-updater
emerge --depclean
revdep-rebuild | Note: this remains true as long as we need to keep both a 2.x and a 3.x Python version active. This was already mentioned in an "eselect news" item if I remember well when python 3 first became available. |
|
Back to top |
|
|
hujuice Guru
Joined: 16 Oct 2007 Posts: 336 Location: Rome, Italy
|
Posted: Sat Mar 26, 2011 9:30 pm Post subject: |
|
|
Quote: | Note: this remains true as long as we need to keep both a 2.x and a 3.x Python version active. This was already mentioned in an "eselect news" item if I remember well when python 3 first became available. |
It's so.
About equery
Quote: | A new but possibly interesting feature of gentoolkit, however its output is a little hard to interpret. |
A good way to interpret the output is to take a look here: http://www.gentoo.org/proj/en/Python/developersguide.xml#doc_chap2
I'm not very skilled in this filed, but it is enough clear there.
I love Gentoo Linux because it is one of the best opensource logic, where knowledge is shared as well as code is.
The prize is that we need to understand. Always...
Regards,
HUjuice _________________ Who hasn't a spine, should have a method.
Chi non ha carattere, deve pur avere un metodo. |
|
Back to top |
|
|
jordanwb l33t
Joined: 10 Jul 2008 Posts: 642 Location: Ottawa, Canada
|
Posted: Sat Mar 26, 2011 10:01 pm Post subject: |
|
|
If you use eog (Gnome's image viewer) or layman, you'll have to recompile them, I did at least. |
|
Back to top |
|
|
cwr Veteran
Joined: 17 Dec 2005 Posts: 1969
|
Posted: Sun Mar 27, 2011 2:22 pm Post subject: |
|
|
Are there in fact any packages which depend on Python 3.0? I suppose there
will be in the end, but at present?
I've actually masked the Python 3x builds, and simply run Python 2.6, and
everything seems to work. I'll update to 2.7, and probably leave things there
until Portage is 3.0 capable.
Will |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6103 Location: Dallas area
|
Posted: Sun Mar 27, 2011 2:25 pm Post subject: |
|
|
cwr wrote: | Are there in fact any packages which depend on Python 3.0? I suppose there
will be in the end, but at present?
I've actually masked the Python 3x builds, and simply run Python 2.6, and
everything seems to work. I'll update to 2.7, and probably leave things there
until Portage is 3.0 capable.
Will |
I've had 3.* masked for a while and have not had anything demand that I have it installed.
When something does need it to compile/emerge then I'll revisit my masking. _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
hujuice Guru
Joined: 16 Oct 2007 Posts: 336 Location: Rome, Italy
|
Posted: Sun Mar 27, 2011 2:45 pm Post subject: |
|
|
cwr wrote: | Are there in fact any packages which depend on Python 3.0? I suppose there
will be in the end, but at present?
I've actually masked the Python 3x builds, and simply run Python 2.6, and
everything seems to work. I'll update to 2.7, and probably leave things there
until Portage is 3.0 capable.
Will |
Python 3.x is simply the last stable version of Python.
So, the portage (rightly, IMHO) cannot decide «ehy folks, you don't need it, I'll mask it for you». Even if it is still rarely needed...
The slotted solution is the right solution for the "portage point of view", while masking Python 3.x is a user solution that make sense if you don't need it.
Regards,
HUjuice _________________ Who hasn't a spine, should have a method.
Chi non ha carattere, deve pur avere un metodo. |
|
Back to top |
|
|
figueroa Advocate
Joined: 14 Aug 2005 Posts: 2965 Location: Edge of marsh USA
|
Posted: Wed Apr 20, 2011 1:14 am Post subject: Upgrading to python-2.7 safely |
|
|
python-2.7.1-r1 x86 became stable today. I ran emerge -uDN world and upon checking /var/log/portage/elog entries, I found:
Quote: | You have just upgraded from an older version of Python.
You should run 'python-updater ${options}' to rebuild Python modules. |
This is very incomplete. Other recent threads on updating python show the necessary steps, but not completely or at least not safely. Here is what I think should be done to update to the current python 2 while avoiding disaster.
1. After "emerge -uDN world" check for messages in /var/log/portage/elog (python update assumed)
2. run "revdep-rebuild -i -p" and if nothing required, fine, or if the results look sane, run "revdep-rebuild" to fix dependency problems.
3. Then, run "eselect python list" to check versions.
4. If list just shows: Quote: | Available Python interpreters:
[1] python2.6 *
[2] python2.7
|
run "eselect python set 2"
5. Then run "python-updater"
6. After that run "emerge --depclean -p" and carefully screen the list for sanity. If in doubt about the proposed removals, double check with "equery d programname" or other tools. Your old python will probably be on the list. Before you let it be deleted, run "equery d python" looking for any version depclean proposes to delete. I found many of my installed packages still needing python-2.6 including portage. Prevent depclean from removing python-2.6 by running "emerge --noreplace =python-2.6.6-r2"
7. Rerun "emerge -udN world" and "revdep-rebuild" to correct any anomalies.
As a side note, I currently have python 3 masked, since nothing I use requires it.
Feel free to add to this thread.
Added by self:
Question - Why does running "equery d =python-2.6.6-r2" and "equery d =python-2.7.1-r1" return exactly the same package list, except with the first many indicate they need 2.6 and with the second many indicate that they need 2.7? Perhaps nothing actually needs python 2.6?
Is it really safe to let emerge --depclean remove python-2.6.6-r2 after following my instructions above? _________________ Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi |
|
Back to top |
|
|
tomk Bodhisattva
Joined: 23 Sep 2003 Posts: 7221 Location: Sat in front of my computer
|
Posted: Wed Apr 20, 2011 8:43 am Post subject: |
|
|
Merged previous post and made this one sticky. _________________ Search | Read | Answer | Report | Strip |
|
Back to top |
|
|
AgBr Apprentice
Joined: 06 Nov 2010 Posts: 195
|
Posted: Thu Apr 21, 2011 2:25 pm Post subject: Python 2 vs Python 3 |
|
|
I am in the process of installing a new notebook from stage3. I just noticed that latest stage3/portage selected python 3.1 as active. My impression from this thread is, that 2.7 just became stable. So why does latest stage3/portage make 3.1 active? |
|
Back to top |
|
|
mikegpitt Advocate
Joined: 22 May 2004 Posts: 3224
|
Posted: Thu Apr 21, 2011 4:25 pm Post subject: Re: Python 2 vs Python 3 |
|
|
AgBr wrote: | I am in the process of installing a new notebook from stage3. I just noticed that latest stage3/portage selected python 3.1 as active. My impression from this thread is, that 2.7 just became stable. So why does latest stage3/portage make 3.1 active? | Portage 2.7 and 3.1 are in different slots, meaning you can have both installed at the same time. Unless something has changed, it is still recommended to keep 2.7 as the system python. If the latest livecd's are going with 3.1, then this could be an update and 3.1 will become recommended... or a mistake.
Interestingly on my system even though python-2.7 is marked stable, it hasn't been pulled in from any recent merges. Perhaps this is because no packages on my system require this version explicitly. |
|
Back to top |
|
|
Longsight n00b
Joined: 23 Apr 2011 Posts: 3
|
Posted: Sat Apr 23, 2011 11:04 pm Post subject: |
|
|
A note on python-updater: if you notice it seems to hang for quite some time around the sys- categories, fear not - it's probably checking whatever kernel sources you have installed. This can take a very flippin' long time. It really ought to be possible to tell it to skip certain packages or categories, as there really is never going to be a need for it to check *-sources, and doing so can take what seems like an eternity on slower machines, especially if you've got a lot of old sources kicking about. |
|
Back to top |
|
|
hamilito n00b
Joined: 18 Aug 2010 Posts: 33
|
Posted: Wed Apr 27, 2011 4:00 pm Post subject: |
|
|
This is an issue I had after upgrading (emerged world which automatically upgraded python from 2.7 to 3.1). Thread:can't emerge anything just in case people reading this post get the same error I got. Maybe it'll help. |
|
Back to top |
|
|
|