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

Ned Deily nad at acm.org
Wed Mar 10 00:07:56 CET 2010

In article <20100309211057.726FA3A4108 at sparrow.telecommunity.com>,
 "P.J. Eby" <pje at telecommunity.com> wrote:

> At 02:57 PM 3/9/2010 -0500, hari jayaram wrote:
> >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-packag
> > es/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.

But adding extra parameters should be unnecessary in this case.  
/Library/Frameworks/Python.framework/Versions/2.6/lib is the default 
location for an OS X framework build, as when using the python.org 
installer.  To install setuptools, you just need to make sure you are 
using the python executable in that framework and distutils will take 
care of installing to the proper location:

 export PATH=/Library/Frameworks/Python.framework/Versions/2.6/bin:$PATH
 sh setuptools-0.6c11-py2.6.egg

 Ned Deily,
 nad at acm.org

More information about the Distutils-SIG mailing list