[Distutils] easy_install: bugs with pathing and multi-version

Phillip J. Eby pje at telecommunity.com
Sat Mar 18 04:07:29 CET 2006

At 10:11 PM 3/16/2006 +0000, Maris Fogels wrote:
>All of our applications are installed in a flat structure; an
>application directory is one big file-soup.  The applications are so
>large that we do not have the budget to correct them, so I must
>emulate this flat structure in the installation target directory.  The
>emulations requires the use of a setup.cfg and the distutils '$base'
># example setup.cfg

Note that easy_install only has the equivalent of an install_lib and 
install_scripts; it doesn't install headers or any data other than package 
data embedded in eggs.

>1. I unpacked the project sources in ~/src/myproject-1.0.  When I tried to
>use easy_install from the ~/src directory it ignores the install-base 
>setting specified in setup.cfg:

By design, easy_install only loads its own settings from ./setup.cfg.  Any 
setup scripts it runs will read their own setup.cfg files, but since 
easy_install only runs "setup.py bdist_egg" on its targets, 
installation-related settings have no effect.

This is intentional, since it's not good practice for a distributed 
setup.cfg to customize the install location.  If easy_install honored those 
settings in the general case, it could result in quite a bit of chaos.

>The command works if I cd into the project directory itself, or if I
>specify the install directory with '-d'

Yes, those are the two ways you can do that.

>2. After successfully installing I attempted to uninstall the project
>as per the instructions on the EasyInstall wiki page, by changing the
>installed files to use a multi-install.  It produces the following error:
>$ cd ~/src/myproject-1.0
>$ easy_install -m .

I suggest using "easy_install -m myproject", as this does not need to run a 
setup script.  Instead, it will simply detect that 'myproject' is already 
installed and remove it from sys.path.

>zipimport.ZipImportError: bad local file header in 
>If I re-run the 'easy_install -m .' command it works properly.
>Everything in the installed .egg file appears to work correctly, so I
>could not figure out why a ZipImportError was being raised by a
>working .egg.

Me either.  The only time I've seen anything like that happen is with 
Python 2.3 on a 64-bit platform.  If you can figure out how to reproduce 
it, please let me know.

>3. This may be a problem with distutils or setuptools, depending on
>how the install command is dispatched.  I thought it would be nice to put the
>install record in the same directory I installed the other files in,
>so I appended the following to setup.cfg:
>Alas, $base is not expanded for the 'record' configuration option.

I think this feature can be added by simply inlcuding 'record' in the list 
of variables that are expanded in line 125 of 
setuptools/command/easy_install.py.  If you have a chance to try that, 
please let me know if it works for you, and then I'll add it to the 
official version.

More information about the Distutils-SIG mailing list