[Distutils] How to disable PYTHONPATH checking when installing packages using distribute

Erik Bray erik.m.bray at gmail.com
Tue Aug 6 19:57:25 CEST 2013

On Fri, Aug 2, 2013 at 8:53 AM,  <lukshuntim at gmail.com> wrote:
> Hi,
> During installing a package which uses distribute (matplotlib in this case),
> it refuses to work with this message
> "running install
> Checking .pth file support in
> /usr/local/stow/matplotlib-1.3.0/lib/python2.7/site-packages/
> /usr/bin/python -E -c pass
> TEST FAILED: /usr/local/stow/matplotlib-1.3.0/lib/python2.7/site-packages/
> does NOT support .pth files
> error: bad install directory or PYTHONPATH
> ...
> Please make the appropriate changes for your system and try again."
> I install local packages using the stow approach, which installs each
> package under its own sub-directory and later "stowed"
> (https://www.gnu.org/software/stow/). Such "error" becomes a nuisance as a
> different PYTHONPATH has to be set for each installation of a package.
> How can the checking be disable? I don't seem to be able to find anything in
> the documentation and would be grateful for any pointer.
> Or maybe it's better turned into a warning and users be reminded to add the
> install directory to PYTHONPATH.

By default setuptools (distribute) installs packages as eggs, and
loading eggs requires the ability to write a .pth file to a directory
that will be checked for .pth files at start up (i.e. is in PYTHONPATH
or otherwise on sys.path by default).  You can avoid doing an
egg-based install by instead running:

python setup.py install --single-version-externally-managed --prefix

or something to that effect.  I think if you do this you also need to
make sure to manually add the .egg-info directory as well.  I think
you can do this with

python setup.py install_egg_info --install-dir

but YMMV.  You might also try just installing with pip since it will
basically install the package in the same way by default.


More information about the Distutils-SIG mailing list