Buildout recursion error on distribute: fixed

Tags: buildout

Several people have seen a hard-to-reproduce recursion error when running buildout in combination with distribute. You’d get 200 lines of “distribute”.

How to prevent/fix the recursion

Good news: the problem has been identified. And I’ve fixed it and the branch is now merged to zc.buildout’s trunk, so it’ll be in the next release.

Temporary fix: the problem surfaces when the currently-used distribute is older than the version that’s available on pypi. So update your (probably system-wide?) distribute to the latest version and the problem also ought to go away. You might need to re-run your bootstrap.

Explanation of the cause

Buildout’s module detects the location of setuptools and buildout at import time and uses those paths when creating scripts. Setuptools’s path is also used when calling easy_install to install .tgz files.

Problem: the install method that calls easy_install detects the setuptools location all over again at runtime. And there’s a recursion in there. The method that searches for the available setuptools detects that there’s a new version available and tries to install it. And searches for the setuptools location. And tries to install it. Repeat.

I fixed it by simply using the pre-detected setuptools location when calling easy_install.

Note that setuptools did not have this recursion problem solely because it was packaged as an .egg, which does not have to go through the easy_install step! So distribute’s (necessary) packaging as a tgz exposed this bug.

blog comments powered by Disqus 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):