Etch and Python 2.5

Need help with C, C++, perl, python, etc?

Etch and Python 2.5

Postby Lavene » 2007-07-07 07:32

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
Lavene
Site admin
 
Posts: 5096
Joined: 2006-01-04 04:26
Location: Oslo, Norway

Postby sinical » 2007-07-07 07:50

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
User avatar
sinical
 
Posts: 1022
Joined: 2007-03-25 11:52

Postby Lavene » 2007-07-07 08:44

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
>>> 

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

Postby sinical » 2007-07-07 09:21

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
User avatar
sinical
 
Posts: 1022
Joined: 2007-03-25 11:52

Postby Lavene » 2007-07-07 09:41

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
Lavene
Site admin
 
Posts: 5096
Joined: 2006-01-04 04:26
Location: Oslo, Norway

Postby sinical » 2007-07-07 10:13

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
User avatar
sinical
 
Posts: 1022
Joined: 2007-03-25 11:52

Postby Lavene » 2007-07-07 10:21

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
Lavene
Site admin
 
Posts: 5096
Joined: 2006-01-04 04:26
Location: Oslo, Norway

update-alternatives

Postby Guest » 2007-07-07 11:10

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.
Guest
 

Postby sinical » 2007-07-07 11:15

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
User avatar
sinical
 
Posts: 1022
Joined: 2007-03-25 11:52

Postby Lavene » 2007-07-07 13:51

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
Lavene
Site admin
 
Posts: 5096
Joined: 2006-01-04 04:26
Location: Oslo, Norway

Etch and Python 2.5

Postby wayzgooser » 2007-10-19 13:44

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

Postby wayzgooser » 2007-10-22 14:28

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
wayzgooser
 
Posts: 63
Joined: 2007-08-11 13:32
Location: London SE

Postby rickh » 2007-10-22 15:04

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
User avatar
rickh
 
Posts: 3473
Joined: 2006-06-29 02:13
Location: Albuquerque, NM USA

Etch and Python 2.5

Postby wayzgooser » 2007-10-23 13:06

It seems I have erred. Point(s) taken - I shall away to other headings - with apologies.
Wayzgooser :)
wayzgooser
 
Posts: 63
Joined: 2007-08-11 13:32
Location: London SE

Postby viniosity » 2007-12-03 06:25

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
viniosity
 
Posts: 46
Joined: 2004-09-15 04:39
Location: DC

Next

Return to Programming

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable