Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Etch and Python 2.5

Programming languages, Coding, Executables, Package Creation, and Scripting.
Message
Author
Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

Etch and Python 2.5

#1 Post by Lavene »

I want to upgrade Python in Etch and make 2.5 the default. I installed it through apt and it works nicely. So far so good... But how do I make it the default version and how do I get all my extra modules 'imported' to 2.5?

I guess I can change the 'python' link in /usr/bin to point to 2.5 and copy /usr/lib/python2.4/site-packages to /usr/lib/python2.5/site-packages but this feels a bit too hackish. Am I missing something here?

Tina

User avatar
sinical
Posts: 1012
Joined: 2007-03-25 11:52

#2 Post by sinical »

Yeah you hacked it :)

Edit /usr/share/python/debian_defaults to this

Code: Select all

[DEFAULT]
# the default python version
default-version = python2.5

# all supported python versions
supported-versions = python2.4, python2.5

# formerly supported python versions
old-versions = python2.3

# unsupported versions, including older versions
unsupported-versions = python2.3
And change the symlink /usr/bin/python to point to python2.5

Edit: And then run

Code: Select all

sudo pycentral updatedefault python2.4 python2.5

Code: Select all

python -V

Should output something similar to


Python 2.5.1

Edit: Formatting fubar
Every cloud has a silver lining, except for the mushroom shaped ones, which have a lining of Strontium 90.
---------------------------------------------
umop apisdn

Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

#3 Post by Lavene »

Thanks sinical, but it didn't quite work:

Code: Select all

/usr/bin# pycentral updatedefault python2.4 python2.5
Traceback (most recent call last):
  File "/usr/bin/pycentral", line 1373, in <module>
    main()
  File "/usr/bin/pycentral", line 1367, in main
    rv = action.run(global_options)
  File "/usr/bin/pycentral", line 1102, in run
    pkg.update_bytecode_files(runtimes, default_rt, bc_option)
  File "/usr/bin/pycentral", line 718, in update_bytecode_files
    self.default_runtime.byte_compile(self.private_files,
AttributeError: 'NoneType' object has no attribute 'byte_compile

Code: Select all

# python -V
Python 2.5

# LANG=C apt-cache policy python2.5
python2.5:
  Installed: 2.5-5
  Candidate: 2.5-5
  Version table:
     2.5.1-1 0
        500 ftp://ftp.no.debian.org testing/main Packages
        500 ftp://ftp.no.debian.org unstable/main Packages
 *** 2.5-5 0
        990 ftp://ftp.no.debian.org etch/main Packages
        100 /var/lib/dpkg/status

# python
Python 2.5 (release25-maint, Dec  9 2006, 14:35:53)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named PyQt4
>>>  
:?:

User avatar
sinical
Posts: 1012
Joined: 2007-03-25 11:52

#4 Post by sinical »

Code: Select all

sudo aptitude install pyqt4-dev-tools python-qt4-dev
python -V
Python 2.5.1
sinical@arcturus:/usr/lib/python2.5/site-packages$ python
Python 2.5.1 (r251:54863, Apr 25 2007, 22:53:30)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt4
>>>
Is PyQt4 in /usr/lib/python2.5/site-packages ?
Every cloud has a silver lining, except for the mushroom shaped ones, which have a lining of Strontium 90.
---------------------------------------------
umop apisdn

Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

#5 Post by Lavene »

sinical wrote:Is PyQt4 in /usr/lib/python2.5/site-packages ?
No, that's the problem. There is absolutely nothing in ../python2.5/site-packages. Surly I don't have to reinstall every third part module? Maybe I need to set the path somewhere?

Tina

User avatar
sinical
Posts: 1012
Joined: 2007-03-25 11:52

#6 Post by sinical »

AFAIK (I am *really* new to using python) you can copy the site-packages from /usr/lib/python2.4 to /usr/lib/python2.5

The problem is the compiled .pyc files - but again .. afaik they are automagically recompiled as needed
Every cloud has a silver lining, except for the mushroom shaped ones, which have a lining of Strontium 90.
---------------------------------------------
umop apisdn

Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

#7 Post by Lavene »

Yeah, I'll try that later and see what happens... The pyc files is no problem, they are, as you are saying, regenerated when needed.

Right now duty calls.

Thanks
Tina

Guest

update-alternatives

#8 Post by Guest »

You can change the default python version through Debian's update-alternatives system.

Just run this command as root:

`update-alternatives --config python'

Then choose the number in the menu that has the version you would like to be default. This also works for text editors, web browsers, and and pretty much any instance where you have multiple versions of the same application installed. See `man update-alternatives' for more details.

User avatar
sinical
Posts: 1012
Joined: 2007-03-25 11:52

#9 Post by sinical »

uh-huh

Code: Select all

sudo update-alternatives --display python
spits out
No alternatives for python.
:roll:
Every cloud has a silver lining, except for the mushroom shaped ones, which have a lining of Strontium 90.
---------------------------------------------
umop apisdn

Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

#10 Post by Lavene »

Just run this command as root:

`update-alternatives --config python'
I have no alternatives set up for Python, besides making 2.5 the default is not the problem, the problem is to bring with me all extra modules I have installed (which is located in /usr/lib/python2.4/site-packages)

But I'll try to just copy it over...

Tina

wayzgooser
Posts: 63
Joined: 2007-08-11 13:32
Location: London SE

Etch and Python 2.5

#11 Post by wayzgooser »

I think I have followed matters thus far, but sadly I'm no nearer making Python 2.5 the default - when I ran the "config" command mentioned here I got the famous TINA answer: "there is no alternative". All I want to do is run Gramps properly - :?
TIA wayzgooser

wayzgooser
Posts: 63
Joined: 2007-08-11 13:32
Location: London SE

Etch and Python 2.5

#12 Post by wayzgooser »

I have read elsewhere and with some care, which has brought me to the understanding that there's nothing wrong with having versions 2.4 and 2.5 of Python installed in the same kit. The only difference seems to be that Python 2.5 is "unsupported". By Debian, I assume. So is it that one MUST install the "unstable" version of Debian? Or am I being quietly urged not to run Gramps? I puzzle on ...
I'd appreciate some guidance.
wayzgooser :D

User avatar
rickh
Posts: 3434
Joined: 2006-06-29 02:13
Location: Albuquerque, NM USA

#13 Post by rickh »

I'd appreciate some guidance.
What you have done here is called "hijacking a thread." You have tacked your unrelated question on the end of someone else's issue. It is considered very impolite, and often means that it will simply be ignored. Start a new thread addressing your own issue. Something like, "Gramps won't work on Etch because it requires Python2.5." It would probably be better off in the "General Questions" forum.
Debian-Lenny/Sid 32/64
Desktop: Generic Core 2 Duo, EVGA 680i, Nvidia
Laptop: Generic Intel SIS/AC97

wayzgooser
Posts: 63
Joined: 2007-08-11 13:32
Location: London SE

Etch and Python 2.5

#14 Post by wayzgooser »

It seems I have erred. Point(s) taken - I shall away to other headings - with apologies.
Wayzgooser :)

User avatar
viniosity
Posts: 46
Joined: 2004-09-15 04:39
Location: DC

#15 Post by viniosity »

Well, I stumbled on this thread b/c I have the same desire to use 2.5.1 instead of 2.4.4. I changed the symlink in /usr/bin and then tried creating a symlink for /usr/lib/python2.5 that pointed to /usr/lib/python2.4 (I moved my original folder out of the way temporarily).

Unfortunately, some things (notably Compiz's fusion-icon) didn't work when I did that. So I'm led to believe that just copying over the contents of your site-packages won't do the trick. Maybe I'm wrong and missed a step - would love to know. Otherwise it's back to the drawing board.

User avatar
Issyer
Posts: 3032
Joined: 2007-05-23 02:59
Location: Khakassia

#16 Post by Issyer »

Compile python from source ./configure --prefix=/opt. It takes 5 minutes. Add to your .bashrc:

Code: Select all

PATH=/opt/bin:$PATH
export PATH

Code: Select all

$ python -V
Python 2.5.1

codecraft
Posts: 6
Joined: 2007-10-25 02:10

#17 Post by codecraft »

maybe we do something on the related issues

andmalc
Posts: 10
Joined: 2008-01-24 19:43

#18 Post by andmalc »

viniosity wrote:Well, I stumbled on this thread b/c I have the same desire to use 2.5.1 instead of 2.4.4. I changed the symlink in /usr/bin and then tried creating a symlink for /usr/lib/python2.5 that pointed to /usr/lib/python2.4 (I moved my original folder out of the way temporarily).
...
For anyone still reading this ...

If you have installed your modules using Python's own package management system 'Easy Install', you can download module versions specifically for the Python version you're using. See here:

http://peak.telecommunity.com/DevCenter ... n-versions

Easy Install is the best way to install Python modules for just a few machines. Installing through Debian's repos is better if you manage many machines as it is more automated.

flywitness
Posts: 2
Joined: 2008-07-11 17:30

#19 Post by flywitness »

So thats it then? Are we concluding that Debian users must re-compile Python in order to get their site-packages into version 2.5?

Seems very strange to me. I would rather find another solution.

User avatar
Issyer
Posts: 3032
Joined: 2007-05-23 02:59
Location: Khakassia

#20 Post by Issyer »

flywitness wrote:I would rather find another solution.
There's one. It's called "ActivePython". It's already binaries and doesn't need to be compiled.
http://www.activestate.com/Products/act ... ndex.mhtml

Post Reply