Easily install all Python versions under Linux and OSX using collective.buildout.python

Note: This information is old. Please head to Github collective/buildout.python for recent information.

Here are short instructions how to install all versions (2.4, 2.5, 2.6, 2.7 and 3.1) of Python interpreters on UNIX system. The instructions were tested on Ubuntu 10.04 Lucid Lynx Linux but should work on other systems as is. The installation is based of downloading, compiling and installing different Pythons and their libraries using buildout tool. A buildout configuration for doing this is maintained by a Plone community.

This buildout is especially useful to get Python 2.4 properly running under the latest Ubuntu 10.04 Lucid Lynx. This is because Ubuntu repositories won’t ship with Python 2.4 packages anymore.

The installation will also include static compilation of some very popular libraries. These are dependencies for other Python packages including, but not limited, to

  • libjpeg
  • Python imaging library
  • readline

1. Prerequisites

  • Some Python version is installed (OS default)
  • GCC compiler is installed (sudo apt-get install build-essential)
  • Subversion tool is installed (sudo apt-get install subversion)

2. Running it

svn co http://svn.plone.org/svn/collective/buildout/python/
cd python
python bootstrap.py

3. Using it

All Pythons are under virtualenv installations. This means that you can activate one Python configuration for your shell once easily (python command will run under different Python versions).

Activating Python 2.4

source python/python-2.4/bin/activate
(python-2.4)moo@murskaamo:~/code$ python -V
Python 2.4.6

Check that Python Imaging Library works

Python 2.4.6 (#1, Jul 16 2010, 10:31:46)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PIL

(No exceptions raised, Python Imaging Library works well).

\"\" Subscribe to RSS feed Follow me on Twitter Follow me on Facebook Follow me Google+

21 thoughts on “Easily install all Python versions under Linux and OSX using collective.buildout.python

  1. Note that to check if PIL is installed properly, you should also try ‘import _imaging’. If that fails, then Plone can start up, but when uploading a picture it will not be converted to the various sizes (thumbnail, preview, etc).

  2. Hello, just a little correction, the minitage’s python can also support sqlite, bdb and all other python official extensions that canno’t be well supported if you don’t have installed the prerequisites on your system, system wide.

    The built python is also built with -rpath ensuring that you won’t have to play with LD_LIBRARY_PATH at runtime.

    But minitage also offers system isolation and project deployment consistency (among OSes and projects).

    As it is related to plone, among minitage, we, at makina also use collective.generic.* packages. The goal of thoses package is to deploy in an unique way our portals, no matter their underlying needs. You click & play in the web ront end, and it generates a portal tarball including the uber buildout, the policy & the theme which will do your project born.

    See http://pypi.python.org/pypi/collective.generic.webbuilder/.

  3. stevew@stevew-laptop:~/python$ python bootstrap.py
    Traceback (most recent call last):
    File “bootstrap.py”, line 113, in
    AttributeError: ‘NoneType’ object has no attribute ‘location’

  4. I think this is usually because Python setuptools (easy_install command) shipped with your OS is too old.

    Try this:

    easy_install -U setuptools # sudo if needed

  5. Pingback: Running 32-bit chroot on 64-bit Ubuntu server to reduce Python memory usage | mFabrik - web and mobile development

  6. What about libxml2 dependencies of Marshaller? Can this way to install make it automatic?

  7. Thanks!

    I get:

    ~/PYTHON_VIRTUALENV/python/python-2.4# ./bin/python
    Python 2.4.6 (#1, Aug 4 2010, 14:42:18)
    [GCC 4.3.2] on linux2
    Type “help”, “copyright”, “credits” or “license” for more information.
    >>> import PIL
    >>> import _imaging
    Traceback (most recent call last):
    File “”, line 1, in ?
    ImportError: libjpeg.so.8: cannot open shared object file: No such file or directory

    so I think something went wrong.

  8. ~/PYTHON_VIRTUALENV/python# find . | grep libjpeg.so

    so they are there.. now pypi is down and I cannot try any more 🙁

  9. Hi,

    Do you know any way to set LD_LIBRARY_PATH during the compilation time? So that buildout would work without changing your system or shell settings?

  10. You can use -rpath to free you from using ld_library_path at runtime.

    Basicly if you have something like this:
    – /bar/include/foo.h
    – /bar/lib/liba.so

    And your target installation path is “/foo”

    Do something like that:
    export CFLAGS=”$CFLAGS -I/bar/include”
    export LDFLAGS=”$LDFKAGS -Wl,-rpath -Wl,/foo -Wl,-rpath -Wl,/bar -L/bar”

    If you want to embed that with buildout, you can have a look to minitage.recipe.cmmi & minitage.recipe.common.

  11. Everytime i try to run bin/buildout i keep getting.

    An internal error occured due to a bug in either zc.buildout or in a
    recipe being used:

    Any clue why this happens?

  12. try run bin/buildout -vvv

    Also the exception traceaback above that line is important.

    The error message you pasted tells “error happened” but not “which error happened”

Leave a Reply

Your email address will not be published. Required fields are marked *