[Distutils] buildout 2 craziness: "upgrading" to distribute 0.6.26 and using site-packages from another python install

Marius Gedminas marius at pov.lt
Fri Apr 5 17:14:52 CEST 2013


On Fri, Apr 05, 2013 at 11:52:17AM -0300, Chris Withers wrote:
> This is driving me nuts, I hope someone can help.
> 
> So, pre-amble, I'm on a Mac, I have a few python installations, the
> ones in play here are:

<snip>
> buzzkill:xlutils chris$ cat bin/buildout
> #!/usr/local/bin/python2.6
> 
> import sys
> sys.path[0:0] = [
>   '/Users/chris/buildout-eggs/distribute-0.6.35-py2.6.egg',
>   '/Users/chris/buildout-eggs/zc.buildout-2.1.0-py2.6.egg',
>   ]
...
> buzzkill:xlutils chris$ bin/buildout
> Upgraded:
>   distribute version 0.6.26;
> restarting.
> Generated script '/Users/chris/LocalGIT/xlutils/bin/buildout'.
...
> buzzkill:xlutils chris$ cat bin/buildout
> #!/usr/local/bin/python2.6
> 
> import sys
> sys.path[0:0] = [
>   '/Users/chris/buildout-eggs/zc.buildout-2.1.0-py2.6.egg',
>   '/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages',
>   ]

I've seen this on Ubuntu.  IIRC a Python 3-bootstrapped buildout ended
up with /usr/lib/python2.7/dist-packages in sys.path, in my case.

> Come again?! Why is site-packages from a *different python
> installation* ending up in bin/buildout?
> 
> Any help here would be very gratefully received...

Workaround #1: run 'bin/buildout -N' so it won't try to upgrade
distribute.

Workaround #2: always always always wrap your buildouts in a virtualenv.
I started using a 'virtual-bootstrap' script that does

  #!/bin/sh
  rm -rf develop-eggs .installed.cfg python
  virtualenv --distribute python
  python/bin/python bootstrap.py
  bin/buildout "$@"

and haven't encountered any issues yet.

Marius Gedminas
-- 
When in trouble or in doubt,
run in circles, scream and shout.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130405/64b37b15/attachment.pgp>


More information about the Distutils-SIG mailing list