05 October 2008
Horrible Hack to get Python 2.6 on Debian or Kubuntu
I wanted to try out the newly-released 2.6 version of our beloved Python, but unfortunately Debian didn't have a package for it yet (and it still doesn't). I wasn't too afraid of screwing up my laptop, as it's probably going to be formatted very soon anyway, and I didn't want to mess around with deb build scripts, so this is what I've done:
- got the official source distribution, untarred and cd in the resulting dir Python2.6
- got some additional packages: apt-get install tk8.4-dev libgdbm-dev libdb-dev libreadline-dev libsqlite3-dev libncurses5-dev (and possibly a few others)
- ./configure --prefix=/usr --enable-ipv6
- make
- checkinstall -D --pkgname=python2.6 --pkgversion=2.6 --maintainer=g.lacava@gmail.com --inspect --backup=yes --install=no make altinstall
This command allowed me to review the package contents and remove what I didn't need, which is basically everything outside the "python2.6" directories and which might already exist on my system (so I didn't want to overwrite it).
I took out the lines /usr/bin/pydoc, /usr/bin/idle and /usr/share/man/man1/python.1
UPDATE: when checkinstall asks if you want to create a default set of docs, say "yes", or you might get an error about ranlib further down (see comments). - installed the produced .deb package
- copied back pydoc and idle (from the build directory) and /usr/share/man/man1/python.1 (from the Misc directory), all with "2.6" appended. I then set up alternatives with update-alternatives --install symlink name alternative priority (mainly in order to "redebianize" my impure karma); UPDATE: well, using alternatives (a 100% Debian solution which works perfectly well for loads of other multi-version script engines) will break your system, because some developers absolutely must reinvent the wheel every 5 minutes and then proudly announce that bugs won't be fixed. The stupidity of it all is staggering.
First impressions: 2.6 seems fast as hell. I don't know if this is due to the custom compilation though, rather than improvements in the runtime.
Labels: Debian, foreverythingelsetherespython, GeekDiary, python
13 Comments:
At 17/10/08 06:22, Anonymous said…
Very useful. Thank you. I never knew about checkinstall, and I was always somewhat annoyed at Debian for publishing such old packages.
At 25/10/08 14:49, Anonymous said…
Thanx to tutorial and knowledge about check-install ;).
At 18/11/08 16:32, Edgar said…
Nice post. Very useful.
I got stuck with checkinstall. when I run it I get this:
/usr/bin/install -c -m 644 pyconfig.h /usr/include/python2.6/pyconfig.h
Creating directory /usr/lib/python2.6/config
ranlib: could not create temporary file whilst writing archive: No more archived files
make: *** [libainstall] Error 1
**** Installation failed. Aborting package creation.
do you have an idea of what is going on?
At 18/11/08 21:28, GiacomoL said…
It looks like the program is not able to create /usr/lib/python2.6/config; it might be a permission issue. I can't remember whether I ran checkinstall as a regular user or as root, but certainly I didn't use sudo (I never use it).
At 19/11/08 23:59, GiacomoL said…
Actually, I ran in the same issue when doing it on my new Kubuntu machine. And it's just a stupid checkinstall bug :( make sure you answer YES when asked to create a default set of docs, and it will work.
At 20/11/08 14:25, Edgar said…
It worked, thanks a lot!
At 20/11/08 18:41, Edgar said…
Hmmm, I tried again from scratch and it didn't work. I realized that when it worked I already had python 2.6 installed, so I installed it first with make altinstall, then did the checkinstall thing, and it worked.
I am not sure the deb package will work fine on another computer.
At 20/11/08 20:39, GiacomoL said…
No, there's no guarantee that it will work on another machine. Checkinstall is not meant to produce redistributable packages, but rather to give you a way of tracking (and reverting) the changes that non-packaged installations would make to a given system. This is why I call it a hack; it tries to conform to package managers as much as possible, but it's a different thing.
Proper "full-on" redistributable packages are produced with flexibility in mind, to be able to adapt to different configurations -- and that's why they're so bloody hard to build :)
At 5/12/08 20:49, Anonymous said…
Thanks for the write up. I used it for Python 3.0 (with some additional args to ./configure) and it came out great.
-Richard
At 5/12/08 22:41, GiacomoL said…
Great to hear that, Richard, because I ddin't manage to :( the _dbm submodule refuses to build on my Kubuntu 8.04...
At 2/1/09 11:52, Anonymous said…
maybe better to use this PPA https://launchpad.net/~doko/+archive
At 2/1/09 12:15, GiacomoL said…
That PPA came out some two weeks after I posted this... I expect sooner or later we'll have proper packages.
At 10/1/09 03:19, anibal said…
I followed all steps by couldn't make pyversions show my 2.6 new version :(
Post a Comment
|Links to this post:
Create a Link
<< Home