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

Chris McDonough chrism at plope.com
Fri Apr 30 08:16:24 CEST 2010


I have a relatively simple buildout that is a directory which is also a
virtualenv (the buildout directory was prepped after checkout with
Python 2.4 "virtualenv --no-site-packages ." and the bootstrap was run
using the resulting "bin/python").

Just now, I had to rerun bin/buildout in that existing directory, and I
got this:

[chrism at thinko deformsite]$ bin/buildout 
Getting distribution for 'zc.buildout'.
Got zc.buildout 1.5.0b1.
Upgraded:
  zc.buildout version 1.5.0b1;
restarting.
Generated script '/home/chrism/projects/deformsite/bin/buildout'.
Develop: '/home/chrism/projects/deformsite/src/deformsite'
Develop: '/home/chrism/projects/deformsite/src/deform'
Develop: '/home/chrism/projects/deformsite/src/colander'
Getting distribution for 'zc.recipe.egg'.
Traceback (most recent call last):
  File "<string>", line 1, in ?
  File
"/home/chrism/projects/deformsite/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/__init__.py", line 2, in ?
    from setuptools.extension import Extension, Library
  File
"/home/chrism/projects/deformsite/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/extension.py", line 1, in ?
    from distutils.core import Extension as _Extension
  File
"/home/chrism/projects/deformsite/lib/python2.4/distutils/__init__.py",
line 3, in ?
    import warnings 
ImportError: No module named warnings
An error occured when trying to install zc.recipe.egg 1.2.3b1. Look
above this message for any errors that were output by easy_install.
While:
  Installing.
  Getting section deformsite.
  Initializing section deformsite.
  Installing recipe zc.recipe.egg.
  Getting distribution for 'zc.recipe.egg'.
Error: Couldn't install: zc.recipe.egg 1.2.3b1

I had built a new virtualenv'ed buildout only a few hours before it the
new zc.buildout was released with the most recent releases of
everything.  I had seen a new release of zc.buildout went up, so I
figured I just needed to kinda start from scratch.  So subsequently I
blew everything away and did what I usually do when I want to start
over:

chrism at thinko projects]$ svn co $REPOZE_SVN/buildouts/deformsite
<snip>
Checked out revision 9276.
[chrism at thinko projects]$ cd deformsite
[chrism at thinko deformsite]$ virtualenv --no-site-packages .
New python executable in ./bin/python
Installing setuptools.............done.
[chrism at thinko deformsite]$ bin/python bootstrap.py 
Creating directory '/home/chrism/projects/deformsite/parts'.
Creating directory '/home/chrism/projects/deformsite/eggs'.
Creating directory '/home/chrism/projects/deformsite/develop-eggs'.
Getting distribution for 'setuptools'.
Got setuptools 0.6c11.

But when I went to run it, I got this:

Generated script '/home/chrism/projects/deformsite/bin/buildout'.
[chrism at thinko deformsite]$ bin/buildout 
Traceback (most recent call last):
  File "bin/buildout", line 14, in ?
    import site # imports custom buildout-generated site.py
  File "/home/chrism/projects/deformsite/parts/buildout/site.py", line
661, in ?
    main()
  File "/home/chrism/projects/deformsite/parts/buildout/site.py", line
628, in main
    virtual_install_main_packages()
  File "/home/chrism/projects/deformsite/parts/buildout/site.py", line
546, in virtual_install_main_packages
    f = open(os.path.join(os.path.dirname(__file__), 'orig-prefix.txt'))
IOError: [Errno 2] No such file or directory:
'/home/chrism/projects/deformsite/parts/buildout/orig-prefix.txt'

If you were paying attention, you'd notice that I made the buildout dir
into a virtualenv above, which I've been doing for a long time now to
get actual isolation.  So at that point, I tried to pin zc.buildout and
zc.recipe.egg to an older version by adding the following to my
buildout.cfg:

versions = versions
[versions]
zc.buildout = 1.4.3
zc.recipe.egg = 1.2.2

But when I then did the same dance that blew up above with the version
pins, it now blew up differently:

[chrism at thinko projects]$ cd deformsite
[chrism at thinko deformsite]$ virtualenv --no-site-packages .
New python executable in ./bin/python
Installing setuptools.............done.
[chrism at thinko deformsite]$ bin/python bootstrap.py 
Creating directory '/home/chrism/projects/deformsite/parts'.
Creating directory '/home/chrism/projects/deformsite/eggs'.
Creating directory '/home/chrism/projects/deformsite/develop-eggs'.
Getting distribution for 'setuptools'.
Got setuptools 0.6c11.
Getting distribution for 'zc.buildout==1.4.3'.
Traceback (most recent call last):
  File "<string>", line 1, in ?
  File
"/home/chrism/projects/deformsite/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/__init__.py", line 2, in ?
    from setuptools.extension import Extension, Library
  File
"/home/chrism/projects/deformsite/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/extension.py", line 1, in ?
    from distutils.core import Extension as _Extension
  File
"/home/chrism/projects/deformsite/lib/python2.4/distutils/__init__.py",
line 3, in ?
    import warnings 
ImportError: No module named warnings
An error occured when trying to install zc.buildout 1.4.3. Look above
this message for any errors that were output by easy_install.
While:
  Bootstrapping.
  Getting distribution for 'zc.buildout==1.4.3'.
Error: Couldn't install: zc.buildout 1.4.3

I pdb stepped through this, and it dies when it reexecutes Python via
os.spawnle of sys.executable (not on the initial execution of "python
bootstrap.py"):

[chrism at thinko deformsite]$ bin/python bootstrap.py 
> /home/chrism/projects/deformsite/bootstrap.py(44)?()
-> assert os.spawnle(
(Pdb) l
 39  	
 40  	ws = pkg_resources.working_set
 41  	
 42  	import pdb; pdb.set_trace()
 43  	
 44  ->	assert os.spawnle(
 45  	    os.P_WAIT, sys.executable, sys.executable,
 46  	    '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
 47  	    dict(os.environ,
 48  	         PYTHONPATH=
 49  	         
(Pdb) p sys.executable, cmd, tmpeggs
('/home/chrism/projects/deformsite/bin/python', 'from
setuptools.command.easy_install import main; main()', '/tmp/tmpEduLSX')
(Pdb) p ws.find(pkg_resources.Requirement.parse('setuptools')).location
'/home/chrism/projects/deformsite/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg'
(Pdb) 

But sure enough, when I run it with a "real" Python instead of the
virtualenv it works.

Likely, the recent developers buildout of don't use virtualenv, so they
won't have seen this behavior.  I don't have the fortitude to debug
buildout right now, and the isolation of a virtualenv keeps us sane.
Ideally, I could change the buildout.cfg somehow to ignore the new
buildout release entirely to get back to a state where buildout could be
driven with a virtualenv-Python.  Any hints?


- C






More information about the Distutils-SIG mailing list