[Distutils] What is the reason for requiring that an explicitly set egg-install installation is in the path?

Phillip J. Eby pje at telecommunity.com
Thu May 18 23:07:50 CEST 2006

At 11:27 AM 5/18/2006 -0400, Jim Fulton wrote:
>Phillip J. Eby wrote:
>>At 10:08 AM 5/18/2006 -0400, Jim Fulton wrote:
>>>If I explicitly specify an installation directory, for example, by
>>>    [install]
>>>    install_lib = ~/py-lib
>>>    install_scripts = ~/bin
>>>in setup.cfg, setuptools gives me an error is the specified
>>>lib dir isn't in the Python path.
>>>Why is this?  Is this for my protection? If so, I don't need a path
>>>nanny. :)
>>Maybe not, but everybody else does.  ;)
>Says you.

Yep.  Before I did that, too many people complained about things not 
working right because they thought they knew better, but didn't.  Have you 
verified that if you set PYTHONPATH to ~/py-lib during installation, but 
not at runtime, that things still work as you intend?  If you haven't 
verified this, you are still in the "think you know better" stage, rather 
than the "actually knows better" stage.  :)

>>>   I can understand this, to some degree, if --prefix is used,
>>>but if I specifically set an install location, setuptools should trust
>>>that I know what the heck I'm doing.
>>EasyInstall is telling you that as things stand, it can't accomplish what 
>>you asked it to -- specifically to install to that directory in such a 
>>way that the package is importable.  If you use -m (aka --multi-version), 
>>then it will not care because getting stuff on the runtime path is then 
>>*your* responsibility, not setuptools'.
>>The issue here is that when you install eggs without -m, the target 
>>directory must support .pth files.  To do that, it must be on PYTHONPATH 
>>(and use a site.py hack) or it must be a "site" directory.  You can 
>>assert that a directory is a "site" directory using --site-dirs, and 
>>EasyInstall will then believe you.
>>In short, use -m or --site-dirs, and in either case EasyInstall will 
>>permit you to be responsible for the results, without nannying.  But if 
>>you don't use either of those options, then it will want proof of your 
>>sanity (i.e. a correct PYTHONPATH) when installing to a non-site directory.  :)
>How about an i_do_not_need_a_path_nanny in the config file? ;)

If the directory already allows .pth files to be processed (or you will 
take responsibility for ensuring this), then just list it in 
--site-dirs.  Otherwise, the correct way to show EasyInstall that you are 
able to set your PYTHONPATH is by setting your PYTHONPATH.  :)

More information about the Distutils-SIG mailing list