[IPython-dev] Weird PYTHONPATH, etc. issue

Fernando Perez fperez.net at gmail.com
Mon Sep 24 20:08:29 EDT 2012

On Mon, Sep 24, 2012 at 1:35 PM, David Warde-Farley
<d.warde.farley at gmail.com> wrote:
> Great, and setuptools path mangling means that all that garbage is
> also added *before* whatever's added by $PYTHONPATH, so I can't put
> ~/src/ipython at the front of the PYTHONPATH to fix it.
> Thanks a lot, setuptools. So am I cooked?

Mmh, that's weird: in the system we were, the usercustomize did happen
after the setuptools nonsense, so we were able to work around that.

Setuptools is simply an abomination, period.  It breaks fundamental
constructs of how python is supposed to work and makes certain things
that are defined in the design of Python impossible.  It's a shame
that it's so widely used, and this is why in ipython we have a strict
policy of avoiding its use as much as possible.

I can only suggest one of two ugly solutions:

- patch your startup scripts for any tool you want
- patch the python call itself: put ~/.local/bin/python to be your own
python script that fixes sys.path for you, and then executes whatever
else was in sys.argv.

Either of these is ugly as hell, but there is no elegant way to slay
setuptools.  It digs itself so deep into the system, undermining every
natural and clean design with underhanded tactics, that only pretty
brutal and ham-fisted solutions seem to be possible.

Sorry you're having to deal with this. Over the years, setuptools has
cost me so much wasted time (precisely because it does stuff like
this) that I have absolutely no tolerance for it.  I can only hope one
day the python world will be rid of that abomination.



More information about the IPython-dev mailing list