[Distutils] easy_install and sys.path
b.n.lawrence at rl.ac.uk
Fri May 18 18:15:40 CEST 2007
Thanks for this.
For the record it seems that debian has patched the site.py to include
the /usr/local tree (and hence all the ubuntu family have this as well).
So, it would appear for Debian it isn't possible to have your own python
in /usr/local at the same version as the system python on a debian system ...
and expect them to be independent. Damn. I appear to have got away with this
in the past because either a) I've had a different version, or b) I haven't
had eggs (or both).
Obviously there are ways around this, one of which you've outlined below
(again, thanks), but it's not very tidy (which you can translate as me not
understanding why they've done this, not complaining about easy_install :-)
On Wednesday 09 May 2007 18:41:52 Phillip J. Eby wrote:
> At 08:25 AM 5/9/2007 +0100, Bryan Lawrence wrote:
> >Oh I know I shouldn't mix two pythons, but I've never had them "mixed"
> > before. (We have run our own python in /usr/local for yonks without any
> > bad karma until now). It's only the advent of eggs, which push things to
> > the top of sys.path that causes a problem. It would appear that I'm not
> > the only person who has the problem (e.g. see
> >So, my question to this list is "why"?
> >Why does easy_install put things in the front of sys.path?
> >Presumably there is
> >some good reason (perhaps it is the only way to ensure that your
> > dependency libraries are the ones that are picked up, I guess there is a
> > risk that older libraries might exist
> That's precisely the reason. Until it started doing this, it had to
> try to either delete those conflicting libraries, or refuse to
> install anything until the user fixed it.
> >I've been a big fan of eggs, but I've just slammed into a wall. I can't
> >believe that I'm the only one for whom this may be a problem. I now need
> > to work out what, if anything, I need to do about it (change my
> > behaviour, find out something I didn't know about egg installation,
> > provide a suggested optional change to egg behaviour, go home have a
> > drink etc ...)
> You can use the "-m" option to easy_install, in which case eggs will
> only be added to sys.path when you ask for them. Just delete your
> existing easy-install.pth file (leaving the setuptools.pth file in
> place). Then, your existing eggs will still be there, and any
> easy_install-provided scripts will still work. You just will have to
> manually require() any eggs you want when you run any program that's
> not a setuptools-generated script, or when you fire up the
> interpreter (unless you modify your .pythonrc to require() the eggs you
> > > '/usr/local/lib/python2.5/site-packages',
> The fact that this is in your sys.path is what's causing those eggs
> to be added, btw. It appears your distro may have either patched
> /usr/lib/python2.5/site.py to include the /usr/local tree, or you
> have a .pth file in /usr/lib/python2.5/site-packages that adds the
> /usr/local/.../site-packages directory.
More information about the Distutils-SIG