Personal tools

Contact Us 24/7 > 1 866.SIX FEET

Skip to content. | Skip to navigation

Home > Blog > Bootstrapping Buildout Killing PYTHONPATH


Bootstrapping Buildout Killing PYTHONPATH

written by Clayton Parker on Monday October 25, 2010
Comments | Filed under: ,

We have been experimenting with using FreeBSD VMs for our development environment instead of relying on OS X. In the past week, we started experiencing really strange behavior with the buildouts on FreeBSD. The tables had turned so it seems, the builds on OS X are now working fine and the FreeBSD builds are failing. To add insult to injury, these issues were happening sporadically on other servers.

The main issue was that when the collective.recipe.plonesite part ran, anything that did a would fail giving an error like this:

Traceback (most recent call last):
File "/usr/home/clayton/projects/my-buildout/bin/instance", line 200, in ?
import plone.recipe.zope2instance.ctl
File "/usr/home/clayton/projects/my-buildout/eggs/plone.recipe.zope2instance-3.6-py2.4.egg/plone/recipe/zope2instance/", line 19, in ?
import zc.recipe.egg
ImportError: No module named recipe.egg

I was finally able to reproduce the error along side a working copy of the same buildout. After having read about the PYTHONPATH changes in the latest version of buildout, I decided to diff the bin directory of the two instances. The diff of the buildout executable was particularly interesting.

--- old-buildout      2010-10-20 17:08:25.000000000 -0400
+++ new-buildout 2010-10-20 17:07:43.000000000 -0400
@@ -1,10 +1,18 @@
+#!/usr/local/bin/python2.4 -S

import sys
sys.path[0:0] = [
- '/usr/home/clayton/.buildout/eggs/setuptools-0.6c11-py2.4.egg',
- '/usr/home/clayton/.buildout/eggs/zc.buildout-1.4.3-py2.4.egg',
- ]
+ '/usr/home/clayton/sixfeetup/projects/sixfeetup/sfupsite-buildout/parts/buildout',
+ ]
+import os
+path = sys.path[0]
+if os.environ.get('PYTHONPATH'):
+ path = os.pathsep.join([path, os.environ['PYTHONPATH']])
+os.environ['BUILDOUT_ORIGINAL_PYTHONPATH'] = os.environ.get('PYTHONPATH', '')
+os.environ['PYTHONPATH'] = path
+import site # imports custom buildout-generated

import zc.buildout.buildout

You can see that the newly bootstrapped buildout has all the new PYTHONPATH setup in it. The workaround for this issue is to simply use the -v option introduced in 1.3.0. Here is the command that allows our buildouts to run fine again:

$ cd path/to/buildout
$ python2.4 -v 1.4.3

After doing that, the buildout gets the proper executable set up and runs fine.

Posted by Alex Clark on Oct 25, 2010 10:13 AM
Thanks for the post! Yeah, this is annoying. I don't like the idea that Buildout is moving in the wrong direction, and I would love to see it fixed ASAP-ish. Toward that end, I've gotten Zope core developer access and am hoping to help Gary Poster (the most active zc.buildout developer) with some fixes soon-ish. Does Buildout have an issue tracker? If so, please open a ticket. If not, please add a ticket to the Plone trac under "installer" and assign it to me (technically not the right category but close enough).
Posted by Eric on Oct 30, 2010 03:15 PM
Hi. Thanks for writing about this. Has the bug been reported? Is there an issue/ticket I could track? Thanks.
Posted by Clayton Parker on Nov 02, 2010 07:58 AM
The tracker for buildout specific issues is on Launchpad:
Posted by mk on Jan 07, 2011 05:58 PM
Hi, I guess it's why I can't buid the desired site. Please provice with more infos. Do I need to downgrade zc.buildout? Thx, MK
Add comment

You can add a comment by filling out the form below. Plain text formatting.


Next Steps

Select a type of support:

Contact our sales team

First name:
Last name:
Phone Number:
Fight spam:
What is + ?
Call Us 1 866.SIX FEET