Re: [Distutils] setuptools error when using --prefix option, complains directory does not exist
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.
In article <20100309211057.726FA3A4108@sparrow.telecommunity.com>, "P.J. Eby" <pje@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@acm.org
At 03:07 PM 3/9/2010 -0800, Ned Deily wrote:
But adding extra parameters should be unnecessary in this case.
True, but I was just explaining the difference between --prefix and --install-dir, which would be relevant for people on all platforms and most all installation directories. ;-)
participants (2)
-
Ned Deily
-
P.J. Eby