[Distutils] Anyone stuck with easy_install / has .pth file issues -- this is for you!

Garrett Cooper yanegomi at gmail.com
Tue May 5 05:53:50 CEST 2009

On Mon, May 4, 2009 at 1:46 PM, P.J. Eby <pje at telecommunity.com> wrote:
> At 01:11 PM 5/4/2009 -0700, Garrett Cooper wrote:
>> You're right -- it doesn't protect against the following (><):
>> /full/path/to/package.egg
>> ./package.egg
> By duplicates, I meant 'package-1.0.egg' and 'package-1.1.egg', not
> alternate paths to the same file.
> (As for the '.' replacement, you might want to look at what I said more
> closely.)

Yeah, I realize where I screwed up now. Thanks :).

>> BTW, wasn't -m deprecated?
> No.

Ah, you're right. Maybe that was another option...

>>  I mean, -m's `delivered' functionality
>> doesn't even work
> You'll need to be more specific there: I don't know what you're saying
> "doesn't work", let alone *how*, what behavior you expect, or what you're
> seeing instead.

Well, if egg 1 and egg 2 define the same module, then the 1st egg's
copy of the module will be loaded and not the second, regardless of
the version criteria defined in the .egg, because sys.modules uses a
dictionary for storage:

[gcooper at orangebox /usr/home/gcooper]$ python -c 'import sys; print
{'copy_reg': <module 'copy_reg' from
'/usr/local/lib/python2.5/copy_reg.pyc'>, '__main__': <module
'__main__' (built-in)>, 'site': <module 'site' from
'/usr/local/lib/python2.5/site.pyc'>, '__builtin__': <module
'__builtin__' (built-in)>, 'encodings': <module 'encodings' from
'encodings.encodings': None, 'posixpath': <module 'posixpath' from
'/usr/local/lib/python2.5/posixpath.pyc'>, 'errno': <module 'errno'
(built-in)>, 'encodings.codecs': None, 'os.path': <module 'posixpath'
from '/usr/local/lib/python2.5/posixpath.pyc'>, '_codecs': <module
'_codecs' (built-in)>, 'stat': <module 'stat' from
'/usr/local/lib/python2.5/stat.pyc'>, 'zipimport': <module 'zipimport'
(built-in)>, 'warnings': <module 'warnings' from
'/usr/local/lib/python2.5/warnings.pyc'>, 'encodings.types': None,
'UserDict': <module 'UserDict' from
'/usr/local/lib/python2.5/UserDict.pyc'>, 'encodings.ascii': <module
'encodings.ascii' from
'/usr/local/lib/python2.5/encodings/ascii.pyc'>, 'sys': <module 'sys'
(built-in)>, 'codecs': <module 'codecs' from
'/usr/local/lib/python2.5/codecs.pyc'>, 'types': <module 'types' from
'/usr/local/lib/python2.5/types.pyc'>, '_types': <module '_types'
(built-in)>, 'signal': <module 'signal' (built-in)>, 'linecache':
<module 'linecache' from '/usr/local/lib/python2.5/linecache.pyc'>,
'posix': <module 'posix' (built-in)>, 'encodings.aliases': <module
'encodings.aliases' from
'/usr/local/lib/python2.5/encodings/aliases.pyc'>, 'exceptions':
<module 'exceptions' (built-in)>, 'os': <module 'os' from

>> because python stores all loaded package / module
>> entries in .pth files as keys in a dictionary _anyhow_
> I also don't know what you mean here.  .pth file contents are added to
> sys.path, not a dictionary.  Unless you're talking about
> sys.path_importer_cache or something, in which case I still don't see the
> connection to anything else at hand.

It turned into a bikeshed item I suppose, but that was what I was
stating about the -m option... meh.

>> I have no idea how -xN factor into this though
> The original docs said to use -m before uninstalling, but they really should
> say -mxN to exclude scripts and avoid installing (or uninstalling!)
> dependencies.  The docs are broken (or at any rate, suboptimal) and should
> be fixed.

Ah, ok. Cool -- thanks :).

>> - The duplicates erasure was just gravy, and purely an exercise on my
>> part getting used to set's in python. The real point was the missing
>> package in .pth functionality, caused by easy_install / setuptools
>> lacking proper MP-safe logic.
> I'm going to guess that by "MP" you mean multiprocessing, in which case I
> would say, yes, easy_install assumes that you are not running multiple
> simultaneous installations to the same directory.

Yesh... that's the problem -- but why should I have to run
easy_install twice :\?

Thanks for the feedback!

More information about the Distutils-SIG mailing list