Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Other Things Gentoo
  • Search

Update to python 3.1, is it safe?

Still need help with Gentoo, and your question doesn't fit in the above forums? Here is your last bastion of hope.
Post Reply
Advanced search
33 posts
  • 1
  • 2
  • Next
Author
Message
Kingoftherings
Guru
Guru
Posts: 328
Joined: Sun May 04, 2008 4:54 am

Update to python 3.1, is it safe?

  • Quote

Post by Kingoftherings » Sun Aug 02, 2009 2:13 am

I just noticed Python 3.1 got added to the Portage tree in ~arch.
Is it safe to update to it? Doesn't Python 3.x break compatibility with 2.x applications?

Basically, what I'm asking is that if I update, will all my python stuff break?

http://packages.gentoo.org/package/dev-lang/python
If it breaks compatibility with older python apps, I would think it'd be masked.
Top
michel7
Guru
Guru
Posts: 461
Joined: Thu May 04, 2006 8:01 pm
Location: localhost

  • Quote

Post by michel7 » Sun Aug 02, 2009 2:37 am

i just tried it out and NOTHING works. python3 seems to break portage so dont try it ...
Software is like sex. It's better when it's free
Top
Kingoftherings
Guru
Guru
Posts: 328
Joined: Sun May 04, 2008 4:54 am

  • Quote

Post by Kingoftherings » Sun Aug 02, 2009 2:50 am

michel7 wrote:i just tried it out and NOTHING works. python3 seems to break portage so dont try it ...
Oh that's right, portage uses python. So you can't even downgrade?
Top
michel7
Guru
Guru
Posts: 461
Joined: Thu May 04, 2006 8:01 pm
Location: localhost

  • Quote

Post by michel7 » Sun Aug 02, 2009 3:10 am

python3 is installed in a new SLOT so there is no need to downgrade. you can switch between python2/python3 with eselect ...
Software is like sex. It's better when it's free
Top
gami
Apprentice
Apprentice
Posts: 297
Joined: Fri Jun 02, 2006 12:32 am

  • Quote

Post by gami » Sun Aug 02, 2009 6:23 am

Python 3.1 is indeed installed in a new slot (like every previous new python minor version). And it is not made the default python on your machine unless you choose to do so yourself with eselect-python. So simply installing Python 3.1 should be safe. If you make it the active version you may encounter problems. Feel free to report those.
Top
poly_poly-man
Advocate
Advocate
User avatar
Posts: 2477
Joined: Wed Dec 06, 2006 9:59 pm
Location: RIT, NY, US
Contact:
Contact poly_poly-man
Website

  • Quote

Post by poly_poly-man » Sun Aug 02, 2009 6:28 am

gami wrote:Python 3.1 is indeed installed in a new slot (like every previous new python minor version). And it is not made the default python on your machine unless you choose to do so yourself with eselect-python. So simply installing Python 3.1 should be safe. If you make it the active version you may encounter problems. Feel free to report those.
doesn't eselect use python?
iVBORw0KGgoAAAANSUhEUgAAA

avatar: new version of logo - see [topic]838248[/topic]. Potentially still a WiP.
Top
LukynZ
Apprentice
Apprentice
User avatar
Posts: 230
Joined: Fri Dec 19, 2008 11:56 am
Location: The Czech Republic

  • Quote

Post by LukynZ » Sun Aug 02, 2009 7:21 am

well yes, it is new slot, but depclean unmerge old one and then is a problem 'cause emerge is in python...
Top
blm
n00b
n00b
Posts: 7
Joined: Wed Dec 14, 2005 9:23 am

  • Quote

Post by blm » Sun Aug 02, 2009 8:38 am

LukynZ wrote:well yes, it is new slot, but depclean unmerge old one and then is a problem 'cause emerge is in python...
Yes, this is indeed a problem... Not thinking I went ahead and did a depclean and removed python-2.6. I ran eselect to switch to python-3.1 but everything portage related is broken. Anyone have any suggestions on how I can get 3.1 working properly with all the portage utils?

When I run emerge I get the following:

Code: Select all

  File "/usr/bin/emerge", line 41
    except PermissionDenied, e:
                           ^
SyntaxError: invalid syntax
Or if I try to run python-updater, which calls portageq:

Code: Select all

  File "/usr/bin/portageq", line 52
    print "ERROR: insufficient parameters!"
                                          ^
SyntaxError: invalid syntax
* Unable to proceed. Can not find PORTDIR. Make sure the command:
*  
*   portageq portdir
* returns a value. If it doesn't, make sure you have updated to
* latest portage version.
*  
* Report bugs to http://bugs.gentoo.org/
I tried editing emerge and portageq to use /usr/bin/python3.1 instead of the /usr/bin/python wrapper to no avail -- results are the same.
Top
LukynZ
Apprentice
Apprentice
User avatar
Posts: 230
Joined: Fri Dec 19, 2008 11:56 am
Location: The Czech Republic

  • Quote

Post by LukynZ » Sun Aug 02, 2009 9:39 am

I fix it by downloading python 2.5, configure and make it in my directory, made a link to this directory and emerge normally 2.6, then switch it by eselect to 2.6 and everything is fine
Top
Arfrever
Bodhisattva
Bodhisattva
Posts: 2463
Joined: Sat Apr 29, 2006 5:27 pm
Location: 異世界

  • Quote

Post by Arfrever » Sun Aug 02, 2009 5:19 pm

poly_poly-man wrote:
gami wrote:Python 3.1 is indeed installed in a new slot (like every previous new python minor version). And it is not made the default python on your machine unless you choose to do so yourself with eselect-python. So simply installing Python 3.1 should be safe. If you make it the active version you may encounter problems. Feel free to report those.
doesn't eselect use python?
eselect is written in bash.
Top
Kingoftherings
Guru
Guru
Posts: 328
Joined: Sun May 04, 2008 4:54 am

  • Quote

Post by Kingoftherings » Sun Aug 02, 2009 6:25 pm

blm wrote: I tried editing emerge and portageq to use /usr/bin/python3.1 instead of the /usr/bin/python wrapper to no avail -- results are the same.
The problem is that Python 3.x changed the 2.x language syntax. So emerge has to be rewritten to support 3.x.
This is the biggest syntax change:

Code: Select all

Old: print "The answer is", 2*2
New: print("The answer is", 2*2)
Top
mtjm
n00b
n00b
Posts: 40
Joined: Tue Nov 25, 2008 9:39 pm
Location: Katowice, Poland
Contact:
Contact mtjm
Website

  • Quote

Post by mtjm » Sun Aug 02, 2009 8:28 pm

Kingoftherings wrote:The problem is that Python 3.x changed the 2.x language syntax. So emerge has to be rewritten to support 3.x.
This is the biggest syntax change:

Code: Select all

Old: print "The answer is", 2*2
New: print("The answer is", 2*2)
The following works in Python 2.6:

Code: Select all

from __future__ import print_function
print("The answer is", 2*2)
For every program it is possible to make it work with both Python 2.6 and Python 3.0.
Top
Bill Cosby
Guru
Guru
User avatar
Posts: 430
Joined: Sat Jan 22, 2005 9:24 am
Location: Aachen, Germany

  • Quote

Post by Bill Cosby » Sun Aug 02, 2009 8:52 pm

I recommend Paludis as a Portage replacement, wasn't it target of attacks because of ABI breakages of C++? :P
The Creature from Jekyll Island.
Top
Arfrever
Bodhisattva
Bodhisattva
Posts: 2463
Joined: Sat Apr 29, 2006 5:27 pm
Location: 異世界

  • Quote

Post by Arfrever » Sun Aug 02, 2009 9:23 pm

mtjm wrote:
Kingoftherings wrote:The problem is that Python 3.x changed the 2.x language syntax. So emerge has to be rewritten to support 3.x.
This is the biggest syntax change:

Code: Select all

Old: print "The answer is", 2*2
New: print("The answer is", 2*2)
The following works in Python 2.6:

Code: Select all

from __future__ import print_function
print("The answer is", 2*2)
The following works in both Python 3.* and all versions of Python 2.*:

Code: Select all

print("The answer is %s" % (2*2))
Anyway `2to3 -f print` automatically updates call to print().
Top
Kingoftherings
Guru
Guru
Posts: 328
Joined: Sun May 04, 2008 4:54 am

  • Quote

Post by Kingoftherings » Sun Aug 02, 2009 10:15 pm

mtjm wrote:
Kingoftherings wrote:The problem is that Python 3.x changed the 2.x language syntax. So emerge has to be rewritten to support 3.x.
This is the biggest syntax change:

Code: Select all

Old: print "The answer is", 2*2
New: print("The answer is", 2*2)
The following works in Python 2.6:

Code: Select all

from __future__ import print_function
print("The answer is", 2*2)
For every program it is possible to make it work with both Python 2.6 and Python 3.0.
Yeah you're right, but the point being that there are changes that don't work in 2.6.
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Sun Aug 02, 2009 10:52 pm

python3 is slotted alongside python2.5 and python2.6
There is already a patchset for portage for it to work with python3

so just don't emerge -C python-2.x just yet (prob won't be feasable till Q2 next year in all honesty and even then some scripts will still rely on a py2.x runtime for a while like plone which only works with py2.4)
if you did you can grab the patchsets from the gentoo python testing overlay and manually add them if you have fubar'ed yr setup :D

I am guessing this is just to get it into the tree (since it does work well, be it with nothing else since nothing else has been ported ;) ) so that as more and more support libs are converted over moving to py3 will be easy in gentoo
Last edited by Naib on Mon Aug 03, 2009 1:35 am, edited 1 time in total.
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Sun Aug 02, 2009 11:10 pm

Kingoftherings wrote:
blm wrote: I tried editing emerge and portageq to use /usr/bin/python3.1 instead of the /usr/bin/python wrapper to no avail -- results are the same.
The problem is that Python 3.x changed the 2.x language syntax. So emerge has to be rewritten to support 3.x.
This is the biggest syntax change:

Code: Select all

Old: print "The answer is", 2*2
New: print("The answer is", 2*2)
print is the biggest breakage since it is a keyword -> function change but it isn't the worst (that can easily be fixed via a sed)
how strings are formatted is a bigger syntax change in my opinion

tbf py2.x -> py3 isn't as bad as the noise is making out. It isn't the 1st time python have broken backwards compatibility, I was bitten py2.3 -> py2.4 when they removed means to access the list being constructed within the list-comprehension, its just this time round there are some bigger syntax changes
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
blm
n00b
n00b
Posts: 7
Joined: Wed Dec 14, 2005 9:23 am

  • Quote

Post by blm » Mon Aug 03, 2009 1:04 am

Doing a manual build of python 2.6 (making sure to install it in a good place!) from source was the easiest thing for me. I just had to edit /usr/bin/emerge and /usr/bin/ebuild to use this installation so I could properly emerge python 2.6 and get it slotted alongside the new 3.1. Thanks for the advice to those who replied!
Top
mtjm
n00b
n00b
Posts: 40
Joined: Tue Nov 25, 2008 9:39 pm
Location: Katowice, Poland
Contact:
Contact mtjm
Website

  • Quote

Post by mtjm » Mon Aug 03, 2009 8:12 am

Naib wrote:tbf py2.x -> py3 isn't as bad as the noise is making out. It isn't the 1st time python have broken backwards compatibility, I was bitten py2.3 -> py2.4 when they removed means to access the list being constructed within the list-comprehension, its just this time round there are some bigger syntax changes
2.4, 2.5 and 2.6 all required porting of some programs. The Plone CMS still uses Python 2.4. For Python 3 just some more changes are done, some of them are removal of features having better alternatives since 2.4 or earlier.
Top
ebichu
Apprentice
Apprentice
User avatar
Posts: 231
Joined: Wed Jul 03, 2002 9:57 am
Location: Manchester, England

  • Quote

Post by ebichu » Mon Aug 03, 2009 1:16 pm

I have python 3.1 and 2.6 installed nicely. I take it it isn't safe a good idea to run 'python-updater' yet due to backwards incompatibilities? Anyway, I tried python-updater (version 0.7) in '--pretend' mode and it wanted to "upgrade" from 3.1 to 2.6 (!) but didn't find any packages that needed to be reemerged.
Ebichu wa chiizu ga daisuki dechu!
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Mon Aug 03, 2009 1:22 pm

make sure : eselect python list is set to py2.6 (python are going for a python wrapper script for multABI compat mode via EPYTHON variable)

python-updater would only work if you changed the eselect python setting tho
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
ebichu
Apprentice
Apprentice
User avatar
Posts: 231
Joined: Wed Jul 03, 2002 9:57 am
Location: Manchester, England

  • Quote

Post by ebichu » Mon Aug 03, 2009 1:31 pm

Naib wrote:make sure : eselect python list is set to py2.6 (python are going for a python wrapper script for multABI compat mode via EPYTHON variable)

python-updater would only work if you changed the eselect python setting tho
Thanks, I forgot python-updater updates to the 'currently selected' version, not the 'latest' version. (And don't worry, I won't make 3.1 the current one just yet!)
Ebichu wa chiizu ga daisuki dechu!
Top
carbonat
n00b
n00b
Posts: 1
Joined: Mon Aug 03, 2009 1:36 pm
Contact:
Contact carbonat
Website

  • Quote

Post by carbonat » Mon Aug 03, 2009 1:44 pm

Apple Mac OS X was initially supported in the main Gentoo portage tree with the ppc-macos keyword. The approach taken then, however, resulted in too many problems, which was the drive behind creating Prefixed Portage. Bootstrapping on OS X is relatively simple, as the system itself provides most of the jobs get up to speed quickly. Prefixed Portage is tested and supported on Mac OS X Tiger and Leopard on PPC and x86 architectures. Stellenangebote
Tests on PPC Panther were successful, but the platform itself isn't fully supported any more.
Last edited by carbonat on Mon Aug 10, 2009 11:02 pm, edited 3 times in total.
Stellenmarkt
Top
Mike Hunt
Watchman
Watchman
User avatar
Posts: 5287
Joined: Sun Jul 19, 2009 11:01 pm

  • Quote

Post by Mike Hunt » Mon Aug 03, 2009 2:01 pm

I like this:

Code: Select all

# cd /usr/portage/profiles/package.mask
# grep -B 2 python ./*
./funtoo-cautionary-# Daniel Robbins <drobbins@funtoo.org> (02 Aug 2009)
./funtoo-cautionary-# let's watch upstream bugs for a bit:
./funtoo-cautionary:>=dev-lang/python-3
Top
pappy_mcfae
Watchman
Watchman
User avatar
Posts: 5999
Joined: Thu Dec 27, 2007 10:51 pm
Location: Pomona, California.
Contact:
Contact pappy_mcfae
Website

  • Quote

Post by pappy_mcfae » Tue Aug 04, 2009 5:22 am

Somehow, I get the feeling there is wisdom in those words...as in I'm staying with 2.6 until forced to change, or until 3.1-r1. Whenever I change to it, I get errors right off the bat, like python-updater, for example. Portage dies, too, of course.

Blessed be!
Pappy
This space left intentionally blank, except for these ASCII symbols.
Top
Post Reply

33 posts
  • 1
  • 2
  • Next

Return to “Other Things Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic