[Distutils] issues with namespace packages on Debian Squeeze and Python 2.6

Carl Meyer carl at oddbird.net
Tue Mar 22 18:57:07 CET 2011

On 03/22/2011 06:50 AM, Reinout van Rees wrote:
> On 11-03-11 14:27, Barry Warsaw wrote:
>>> I have tried with system default python 2.5, and namespace packages
>>> >works. The same when I create a virtual environment with python 2.6.
>>> >The problem seems to just be with system default python 2.6.
>>> >
>>> >I'm using the original setuptools (installed from sources), and not the
>>> >one provided by Debian.
>> Yes, I think this is going to give you problems because it doesn't
>> know about
>> dist-packages, and site-packages is not on sys.path by default in the
>> system
>> Python.  Please try again with the Ubuntu setuptools package (which is
>> really
>> distribute).  It's been modified to know about dist-packages.

Debian/Ubuntu's setuptools package has been modified to _install into_
dist-packages in /usr/local, but it has no control over sys.path.
Putting dist-packages onto sys.path is handled by Debian/Ubuntu
modifications to the site.py in the Python standard library; it isn't
affected by which setuptools you use.

That said, I haven't looked into the specific problem with namespace
packages - it's still possible that using the Debian/Ubuntu setuptools
package to install the namespace packages might solve that.

> Note that this debian-specific behaviour also "ruins" other things:
> buildout 1.5+ can detect system-wide installed eggs and use them if you
> tell it to. Handy if you want to use stuff like mapnik and so with lots
> of dependencies.
> Only: buildout cannot detect the eggs in their non-standard locations as
> buildout obviously doesn't have the ubuntu setuptools' fix...

This sounds more likely to be caused by not having the site.py changes I
mentioned above. IIRC buildout 1.5 uses "python -S" to avoid the
automatic import of site.py, so it would never see the Debian/Ubuntu
modifications in site.py. As long as buildout uses "-S", I think the
only fix for that would be for buildout's "detect system-wide eggs"
feature to add in explicit workaround/support for dist-packages. This is
what virtualenv does.


More information about the Distutils-SIG mailing list