[Distutils] new zc.buildout and virtualenv no longer friends?

Gary Poster gary.poster at canonical.com
Fri Apr 30 19:40:03 CEST 2010


On Apr 30, 2010, at 1:09 PM, Maurits van Rees wrote:

> Op 30-04-10 16:32, Gary Poster schreef:
>> 
>> On Apr 30, 2010, at 3:25 AM, Chris McDonough wrote:
>>> - Running the above bootstrap.py with the virtualenv python and the
>>> -v1.4.3 argument.
>>> 
>>>  bin/python bootstrap.py -v1.4.3
>>> 
>>> - Run bin/buildout
>>> 
>>> That produces a working environment.
>> 
>> Thanks for the clear instructions for the work-around, Chris and Rok.
>> 
>> While one of the goals of the new buildout is to make virtualenv unnecessary with it if desired, I think it is a priority that virtualenv and zc.buildout continue to be able to work together.  I'll investigate this report today.
> 
> For the record, I see the same thing.  I'll post some observations here in case they help in debugging.
> 
> I have a python in a virtualenv and that one is on the PATH so it gets used by default.  It gives the same problems the others were seeing.
> 
> Using the system python (Mac 10.6 btw) works.

The core problem of the virtualenv integration, from my perspective, is that I expect python -S to give a Python with the stdlib installed.  When you use virtualenv, this is not the case.

In a standard interpreter:

$ python -S
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2
>>> import ConfigParser
>>> 

In virtualenv:

$ ../bin/python -S
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2
>>> import ConfigParser
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named ConfigParser
>>> 

The only solutions to this that I see are the following (choose one):

1. virtualenv fixes the -S flag.  I doubt the virtualenv maintainers care, but if they did, that would be great.

2. zc.buildout and bootstrap special case virtualenv: if virtualenv is sniffed (handwave...), we don't use -S.  This is messy, but it means that virtualenv users get what they want without fuss, and non-virtualenv users can use a system Python without fuss.

3. zc.buildout and bootstrap grow an explicit flag to allow site-packages in (extra points if I can do it with only one flag for both cases).  The downside, in addition to complexity, is that then somebody loses: either virtualenv users have to do something special, or people who want to use a system Python with zc.buildout transparently have to do something special.

Unless virtualenv folks offer an implementation for #1...I'll decide whether to pursue #2 or #3.

Gary


More information about the Distutils-SIG mailing list