[Distutils] setuptools error when using --prefix option, complains directory does not exist

P.J. Eby pje at telecommunity.com
Tue Mar 9 22:11:02 CET 2010


At 02:57 PM 3/9/2010 -0500, hari jayaram wrote:
>Hi
>
>I am installing setuptools using the --prefix option it complains 
>the directory does not exist even though it does. The install works 
>however when I use the --instal-dir option as it recommends.
>
>macbook-pro-17:~ hari$ sudo sh setuptools-0.6c11-py2.6.egg 
>--prefix=/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages

That's because the directory you gave is not a *prefix*, it's an 
installation directory.
A prefix, in distutils terms, is generally the top-level directory 
under which Python's lib, bin, and other directories are located.

So, the correct --prefix would be 
"/Library/Frameworks/Python.framework/Versions/2.6" in this 
case.  (Notice the absence of lib/python2.6/site-packages.)


>     [Errno 2] No such file or directory: 
> '/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/lib/python2.6/site-packages/test-easy-install-79530.pth'

If you look closely at this path, you'll see that when the distutils 
creates an install directory from your prefix (which is already an 
installation directory), you end up trying to install to a 
'lib/python2.6/site-packages/lib/python2.6/site-packages' 
directory.  That's because when you give a prefix, distutils decides 
what subdirectories of the prefix to install things in, and it can't 
tell that you already gave it a subdirectory of the prefix.



More information about the Distutils-SIG mailing list