Buildout and Virtualenv
by jfroche — last modified 2007-12-08 14:56
How and why use buildout with virtualenv
Buildout is this wonderful tool which helps you to automate setup and configuration of your applications.
Virtualenv is a tool which will help you to isolate your python environmentA few days ago I got stuck during a long time because I didn't see that one library I installed in my global site-packages of my favourite python 2.4 (on my ubuntu: /usr/lib/python2.4/site-packages/) was a lower version of a library I was using in my buildout. Package was sqlalchemy 0.4 in my global sites-package and my buildout based application was using sqlalchemy 0.3.8 ... Here is a simple solution to avoid this kind of things.
Idea is to start buildout with a python free of any external library. Virtualenv is the answer.
$ easy_install virtualenv
you will have then a file that you can run: /usr/bin/virtualenv
Let's say you have a buildout configuration go into it:
$ cd myApp.buildoutNow you just have to create the python environment without any access to the global site-packages with virtualenv:
$ virtualenv --no-site-packages .You will have then your new python in the bin folder :
$ ls -l binYou can now run the buildout configuration with your new python:
$ ./bin/python2.4 bootstrap.pyThis will create you a nice and totally isolated environment ...