[Distutils] Trouble installing Myghty with --prefix

Phillip J. Eby pje at telecommunity.com
Wed Nov 30 18:03:39 CET 2005

At 10:32 AM 11/30/2005 -0600, Ian Bicking wrote:
>skip at pobox.com wrote:
> > I tried installing Myghty 0.99a using this command:
> >
> >     python setup.py install --prefix=/usr/local/mojam
> >
> > (e.g., non-standard install location).  It downloaded setuptools and
> > installed a bunch of other stuff (Paste, etc), all available as eggs.
> > Unfortunately, it didn't create packages and didn't make the pkg_resources
> > module available.  Any hints about how to get this working would be
> > appreciated.  (I have no idea what other details you'll need, never having
> > used setuptools - directly or indirectly.  Let me know if there's more 
> I can
> > do to explain the situation.)
>I suspect it's because setuptools didn't think that
>/usr/local/mojam/lib/... was on the normal site path, and so .pth files
>aren't read from the location.  And when .pth files aren't read, the
>eggs won't be put on the path automatically (though I don't know quite
>how setuptools can work at all when that happens).

That's correct.  Skip, if you want to use a custom install location using 
PYTHONPATH, you need to read this section:


Your configuration, however, would be something like:

     prefix = /usr/local/mojam

     site_dirs = /usr/local/mojam/lib/python2.4/site-packages

instead of the configurations shown there.

>There's non-root installation instructions on the setuptools site (and
>maybe included in easy_install now?) that will create a full Python
>environment in a non-standard location, which would probably resolve
>this issue.

Right; the other option is to use this approach:


There's a 'virtual-python' script linked there that will set it up for you; 
you would run:

     virtual-python.py --prefix=/usr/local/mojam

to set it up.  This should not delete any existing files there, just add 
symlinks and create a /usr/local/mojam/bin/python executable that will 
think its sys.prefix is /usr/local/mojam.  (It will overwrite 
/usr/local/mojam/bin/python, though, if it already exists.)

In contrast to the other approach above, the "virtual" Python installation 
will not need any special configuration, because as far as it knows, it was 
built to live in /usr/local/mojam and all its defaults and installation 
locations will work fine.  At that point you should make sure that 
/usr/local/mojam/bin is on PATH, and use that Python for everything from 
then on.

More information about the Distutils-SIG mailing list