[Distutils] Installing namespace packages with pip inserts strange modules into sys.modules

Erik Bray erik.m.bray at gmail.com
Fri Sep 12 21:55:20 CEST 2014


On Fri, Sep 12, 2014 at 3:24 PM, Eric V. Smith <eric at trueblade.com> wrote:
> [Oops, replying to the list this time. Sorry for the dupe, Thomas.]
>
> On 9/12/2014 3:14 PM, Thomas Heller wrote:
>> So it seems that it is a bug in setuptools:  It must not create or
>> install these pth files when installing in Python 3.3 or newer (which
>> implement PEP 420).
>
> PEP 420 goes out of its way to support pkgutil.extend_path():
> http://legacy.python.org/dev/peps/pep-0420/#migrating-from-legacy-namespace-packages
>
> So it should be possible for some cross-version code to work.

The pkgutil.extend_path() way can be made to work with PEP 420
reasonably well, but *not* with the older setuptools approach.

Unfortunately there are some dark corners of setuptools I've
encountered where namespace packages don't work properly during
installation *unless* they were installed in the old-fashioned
setuptools way.  I'll have to see if I can dig up what those cases
are, because they should be fixed.

Erik


More information about the Distutils-SIG mailing list