Installing Python 2.6 from source on Ubuntu Hardy
Python 2.6 was released yesterday! This version aims to smooth the transition from Python 2.5 to Python 3.0 which is planned for release soon (currently available as a release candidate). Python 3.0 will be break backwards compatibility with the 2.x series. Python 2.6 is backwards compatible with 2.5. All the backwards compatible features of 3.0 have been backported to 2.6.
One of the new 2.6 features I'm particularly intersted in is
the new
multiprocessing module which has a similar interface to
the
threading module, but it uses processes instead of threads.
This avoids the limitations imposed by the Global Interpreter Lock
in a multi-threaded Python program. Yet it still has the nice
communications and management features like Pipe()s,
Queues, Pools, etc. I didn't plan to
focus so much on the multiprocessing module in this post-- I just want
to document my install notes on Ubuntu Linux. For all the new features
in 2.6 see What's
New in Python 2.6. (It is a long list).
- Download the Python 2.6 compressed source tarball
$ cd incoming $ wget http://www.python.org/ftp/python/2.6/Python-2.6.tgz
- Unpack
$ tar zxvf Python-2.6.tgz
- Read the README at
~/incoming/Python-2.6/README
- Install prerequisites (Disclaimer: I know nothing about libraries,
packages, dependencies, etc. This is what I did-- I am not sure
if I grabbed the correct prerequisites or not.)
$ sudo apt-get install build-essential $ sudo apt-get install libncursesw5-dev $ sudo apt-get install libreadline5-dev $ sudo apt-get install libssl-dev $ sudo apt-get install libgdbm-dev $ sudo apt-get install libbz2-dev $ sudo apt-get install libc6-dev $ sudo apt-get install libsqlite3-dev $ sudo apt-get install tk-dev
- Configure. I am installing to
~/lib/python2.6.$ cd Python-2.6 $ ./configure --prefix=/home/sofeng/lib/python2.6
- Make
$ make
Note I got the following message:Failed to find the necessary bits to build these modules: bsddb185 sunaudiodev To find the necessary bits, look in setup.py in detect_modules() for the module's name.
I was not able to find the Ubuntu packages for these.
- Try it out (Optional)
$ ./python
Python 2.6 (r26:66714, Oct 2 2008, 15:32:46) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>
- Test (Optional)
$ make test
I got the following status:327 tests OK. 33 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_curses test_gl test_imgfile test_kqueue test_linuxaudiodev test_macos test_macostools test_normalization test_ossaudiodev test_pep277 test_py3kwarn test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_timeout test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 Those skips are all expected on linux2. - Install
$ make install
- Finally, I added
~/lib/python/bin/python2.6to myPATH
Notes
The first time I ran, I got this message:
Failed to find the necessary bits to build these modules: _hashlib _ssl bsddb185 bz2 gdbm readline sunaudiodev To find the necessary bits, look in setup.py in detect_modules() for the module's name.
I think I found Ubuntu packages for some of them:
- _hashlib and _ssl in libssl-dev
- bz2 in libbz2-dev
- gdbm in libgdbm-dev
- readline in libreadline5-dev
Related posts
- How to use pip with crate.io — posted 2012-10-24
- How to install MySQLdb in a virtualenv on Ubuntu Karmic — posted 2010-02-15
- How to install pip on Ubuntu — posted 2010-02-15
-
Using psycopg2 with virtualenv on Ubuntu
JauntyMaverick — posted 2009-07-31 - Notes on using pip and virtualenv with Django — posted 2009-05-06
13
Comments
—
Comments feed for this post
#2 Eliot commented on 2008-10-03:
--, Thanks for the tip. I probably installed sqlite and tkinter already, so I missed them. I will look into checkinstall
#3 Sybren A. Stüvel commented on 2008-10-03:
An easier way to get all the required dependencies, is to use apt-get to install the build dependencies for Python 2.5:
apt-get build-dep python2.5
The only warnings I get then are:
Failed to find the necessary bits to build these modules:
bsddb185 sunaudiodev
To find the necessary bits, look in setup.py in
detect_modules() for the module's name.
#4 Eliot commented on 2008-10-03:
Sybren, This sounds like a much easier way. Thanks a lot for the tip!
#5 Marek Kubica commented on 2008-10-17:
bsddb185 is an obsolete module and sunaudiodev is only available on Sun Solaris.
#8 Eliot commented on 2008-12-08:
Henry, I did not get this error so I'm not sure, but I found a possible solution here: http://evalinux.wordpress.com/2008/12/04/installing-python-30-on-ubuntu-810-intrepid-ibex/#comment-493
#9 James Rubino commented on 2009-04-03:
How can I make Python 2.6 the "Grand Pumba" of python installs in my system?
#10 Jeff commented on 2009-04-16:
I second that question. To remove all previous installations, and only use 2.6, what do we do?
anyone?
#11 Eliot commented on 2009-04-16:
James, Jeff,
If you wait another week (April 23), you can get Python 2.6 as the default python package in Ubuntu 9.04 Jaunty Jackalope. http://packages.ubuntu.com/jaunty/python/python If you can't wait, the Jaunty Release Candidate is available today.
Post a comment
About
I'm Eliot and this is my notepad for programming topics such as Python, Django, Ubuntu, Emacs, etc... more »
Search Blog
Tags
-
algorithms
(6)
-
android
(2)
-
aws
(10)
-
blogproject
(20)
-
c_cplusplus
(12)
-
cardstore
(8)
-
colinux
(2)
-
concurrency
(13)
-
conkeror
(2)
-
core
(2)
-
cygwin
(17)
-
datastructures
(15)
-
datetime
(4)
-
decorators
(4)
-
django
(41)
-
emacs
(22)
-
files_directories
(12)
-
git
(6)
-
hardware
(6)
-
install_setup
(8)
-
javascript
(3)
-
keyboard
(9)
-
matplotlib
(6)
-
mercurial
(4)
-
nginx
(2)
-
persistence
(6)
-
preferences
(7)
-
processes
(4)
-
pyqt
(18)
-
python
(157)
-
ratpoison
(3)
-
regexes
(6)
-
rsync
(3)
-
softwaretools
(17)
-
sql
(14)
-
ssh
(12)
-
subversion
(6)
-
twisted
(7)
-
ubuntu
(66)
-
urxvt
(5)
-
vxworks
(25)
-
webdev
(8)
-
wmii
(7)
Blogroll
- Adam Gomaa
- Alex Clemesha
- Amir Salihefendic
- Armin Ronacher
- David Beazley
- David Ziegler
- Duncan McGreggor
- Gareth Rushgrave
- Glyph Lefkowitz
- Guido van Rossum
- Ian Bicking
- Jacob Kaplan-Moss
- James Bennett
- James Tauber
- Jesper Noehr
- Marty Alchin
- Matt Harrison
- Nikolay Kolev
- Parand Darugar
- Peter Baumgartner
- Peter Bengtsson
- Rob Hudson
- Simon Willison
- Will McGugan
#1 -- commented on 2008-10-03:
For me (Hardy, too), additionally the following packages were missing:
I couldn't find packages for:
I recommend using 'checkinstall', because that way you can later easily replace the RC1 with the final: