Buildout 2 and setuptools 0.7/0.8 problems and some solutions

Tags: python, django

Distribute (which was a well-maintained fork of setuptools) is now renamed back to setuptools. So setuptools 0.7 (and now 0.8) is out. And distribute is deprecated.

But since distribute had to pretend it was really setuptools, all sorts of hacks needed to be used. And now all those hacks have to be worked around again. => problems.

I now run into buildout problems. Running bootstrap can fail:

$ python
Traceback (most recent call last):
  File "/home/vagrant/tools/bin/python", line 66, in <module>
    exec(compile(, __file__, "exec"))
  File "", line 154, in <module>
  File ".../distribute-0.6.34-py2.7.egg/", line 696, in require
    needed = self.resolve(parse_requirements(requirements))
  File ".../eggs/distribute-0.6.34-py2.7.egg/", line 598, in resolve
    raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (setuptools 0.6c11
    (/usr/lib/python2.7/dist-packages), Requirement.parse('setuptools>=0.7'))

Solution 1: fresh bootstrap

Solution is apparently to download a fresh bootstrap:

For me, that didn’t help as a global setuptools/distribute installation was in the way.

Solution 2: update global setuptools

Apparently I really need to update my local setuptools installation. Hey, there’s a new new temporary distribute that installs the actual 0.8 setuptools for you:

$ sudo pip install -U distribute
Downloading/unpacking distribute from
  Downloading (145Kb): 145Kb downloaded
  Running egg_info for package distribute

Downloading/unpacking setuptools>=0.7 (from distribute)
  Downloading setuptools-0.8.tar.gz (756Kb): 756Kb downloaded
  Running egg_info for package setuptools

Installing collected packages: distribute, setuptools
  Found existing installation: distribute 0.6.28
    Uninstalling distribute:
      Successfully uninstalled distribute
  Running install for distribute

  Found existing installation: distribute 0.6.28
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-1.1-py2.7.egg/pip/", line 104, in main
    status =, args)
  File "/Library/Python/2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/", line 250, in run
    requirement_set.install(install_options, global_options)
  File "/Library/Python/2.7/site-packages/pip-1.1-py2.7.egg/pip/", line 1129, in install
  File "/Library/Python/2.7/site-packages/pip-1.1-py2.7.egg/pip/", line 477, in uninstall
  File "build/bdist.macosx-10.8-intel/egg/", line 1213, in get_metadata_lines
  File "build/bdist.macosx-10.8-intel/egg/", line 1205, in get_metadata
  File "build/bdist.macosx-10.8-intel/egg/", line 1270, in _get
IOError: zipimport: can not open file /Library/Python/2.7/site-packages/distribute-0.6.28-py2.7.egg

Storing complete log in /Users/reinout/Library/Logs/pip.log

Oh what?? That was on OSX. Let’s try again:

ImportError: Entry point ('console_scripts', 'easy_install') not found

Oh hell, my entire installation got mutilated.

I saw that too on one of my ubuntu boxes:

$ sudo easy_install -U distribute
Traceback (most recent call last):
  File "/usr/local/bin/easy_install", line 9, in <module>
    load_entry_point('distribute', 'console_scripts', 'easy_install')()
  File "/usr/local/lib/python2.7/dist-packages/setuptools-0.8-py2.7.egg/", line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python2.7/dist-packages/setuptools-0.8-py2.7.egg/", line 2565, in load_entry_point
    raise ImportError("Entry point %r not found" % ((group,name),))
ImportError: Entry point ('console_scripts', 'easy_install') not found

Normally I’d take that as a message that a previously-patched-and-thus-empty setuptools installation is now used. But…

Solution 3: freshly installed setuptools

What worked:

$ wget
$ sudo /usr/bin/python

This gives you a nice fresh globally installed setuptools 0.8.

Another problem: buildout development setuptools egg

Somehow some of my buildouts had a development egg link to a setuptools or distribute version. For that I had to remove the contents of the develop-eggs/ directory in my buildout.

Another problem part two: dev eggs again

I use a recipe (syseggrecipe) that makes it easier to use globally installed packages. Especially handy for numpy/scipy and geographical libraries.

It works by adding development egg links to those packages it finds. And, of course, one of those directories with one of those packages also contained an older version of setuptools:

$ python
Setting socket time out to 1 seconds.
$ bin/buildout
Setting socket time out to 1 seconds.
  Checking for upgrades.
Error: There is a version conflict.
We already have: setuptools 0.6c11
but zc.buildout 2.2.0 requires 'setuptools>=0.7

The solution here:

$ sudo rm -rf /usr/lib/python2.7/dist-packages/setuptools*

Summary of how I got it working

  • Zap setuptools and distribute in any global locations that can interfere.

  • Install setuptools 0.8 with the ez_setup method that I also showed as ‘solution 3’ above.

  • Use the latest buildout bootstrap (‘solution 1’). logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):