Easily install all Python versions under Linux and OSX using collective.buildout.python
Posted on July 16, 2010 by Mikko Ohtamaa
Filed Under plone, python, technology, ubuntu
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
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)
Running it
svn co http://svn.plone.org/svn/collective/buildout/python/ cd python python bootstrap.py bin/buildout
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 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).
Read our blog
Subscribe mFabrik blog in a reader
Follow us on Twitter
Mikko Ohtamaa on LinkedIn
Other posts by Mikko Ohtamaa



http://minitage.org is able to do that about a year or two. You should try it and contact the author on #plone : kiorky
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).
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/.
stevew@stevew-laptop:~/python$ python bootstrap.py
Traceback (most recent call last):
File “bootstrap.py”, line 113, in
ws.find(pkg_resources.Requirement.parse(requirement)).location
AttributeError: ‘NoneType’ object has no attribute ‘location’
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
If you want to build Python on Linux using system libraries try this buildout instead:
https://svn.plone.org/svn/collective/buildout/bda-naked-python/
Here are some instructions:
http://permalink.gmane.org/gmane.comp.web.zope.plone.product-developers/4966
This will also be useful for folks who need 2.5 for Google App Engine (it’s not in Lucid Lynx either)
Re: ws.find bug: Fixed by Wichert: https://bugs.launchpad.net/zc.buildout/+bug/410528
I hit same bug using bda-naked-python.
[...] integration for Python and Plone CMSDebugging Skype crash problems on Ubuntu 10.04 Lucid Lynx LinuxEasily install all Python versions under Linux and OSX using collective.buildout.pythonChanging the location of Ubuntu 10.04 Lucid Lynx notification bubble to a different cornermFabrik to [...]
What about libxml2 dependencies of Marshaller? Can this way to install make it automatic?
http://pypi.python.org/pypi/z3c.recipe.staticlxml/0.7.1
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.
http://plone.293351.n2.nabble.com/Python-buildout-on-Ubuntu-10-04-import-imaging-failing-due-to-libjpeg-td5104024.html
~/PYTHON_VIRTUALENV/python# find . | grep libjpeg.so
./python-2.4/lib/libjpeg.so.8.0.2
./python-2.4/lib/libjpeg.so.8
./python-2.4/lib/libjpeg.so
./python-2.5/lib/libjpeg.so.8.0.2
./python-2.5/lib/libjpeg.so.8
./python-2.5/lib/libjpeg.so
./python-2.6/lib/libjpeg.so.8.0.2
./python-2.6/lib/libjpeg.so.8
./python-2.6/lib/libjpeg.so
./parts/opt/lib/libjpeg.so.8.0.2
./parts/opt/lib/libjpeg.so.8
./parts/opt/lib/libjpeg.so
so they are there.. now pypi is down and I cannot try any more
Just Do This:
echo ‘/usr/local/lib’ >> /etc/ld.so.conf
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?
You can use -rpath to free you from using ld_library_path at runtime.
See:
- http://en.wikipedia.org/wiki/Rpath_%28linking%29
- http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
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.