views:

56

answers:

2

I am switching from Linux to OSX and when I run our build's setup.py script, I get an error message that contains the text

This script requires setuptools version 0.6c7.

I have tried several times to install setuptools, and have verified that the setuptools egg exists in /Library/Python/2.6/site-packages. I have no idea why it is not being recognized.

A: 

Have you tried to import setuptools in your setup.pyscript?

import setuptools

This solved my setuptool-ish build problems in the past.

The MYYN
If I open a python shell and import setuptools, I get the following message: 'zipimport.ZipImportError: can't decompress data; zlib not available'. I miss Linux.
AFAIK, zlib is already included as part of Mac OS X
The MYYN
+1  A: 

It is very common to have multiple versions of Python on OS X systems. In recent releases of OS X, Apple has shipped two versions itself (in /usr/bin). You may have installed more recent versions using installers from python.org (which generally exist in /Library/Frameworks/Python.framework or using a package distributor like MacPorts (which install in /opt/local/Library/Frameworks/Python.framework). Keep in mind that each version of Python requires its own copy of setuptools.

Since the site package path you report is /Library/Python/2.6/site-packages, it is most likely you have used the Apple-supplied Python 2.6.1 in OS X 10.6 to try to install a new version of setuptools. Note that Apple already supplies setuptools for its Pythons (0.6c9 for 2.6.1 in 10.6); the corresponding easy_install commands are in /usr/bin.

$ /usr/bin/python2.6 -c 'import setuptools;print(setuptools.__file__,setuptools.__version__)'
('/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/setuptools/__init__.pyc', '0.6c9')

If you are using another non-Apple-supplied Python, follow the instructions to install a new version of setuptools (or Distribute) making sure you are invoking the right version of Python. Check your shell PATH and which python to make sure.

If that doesn't help, update your question with more information.

UPDATE: Based on your further comments, it seems something was amiss in your default site-packages directory. With that problem out of the way and having established that there is an Apple-supplied setuptools version 0.6c9 installed, it appears the package you are trying to install is looking for a specific, earlier version of setuptools, 0.6c7. If that is the case, you should first determine why that is and if it is necessary. Chances are that it is just an incorrect version specification in the package's setup.py file, i.e. using == rather than >=. If you can, edit the setup.py so it can use a newer version. In the unlikely event that the package really does need that specific older version of setuptools (which may not even work with that version of Python or OS X), you could try installing the older version, like so:

$ sudo /usr/bin/easy_install-2.6 setuptools==0.6c7
$ /usr/bin/python2.6 -c 'import setuptools;print(setuptools.__file__,setuptools.__version__)'
('/Library/Python/2.6/site-packages/setuptools-0.6c7-py2.6.egg/setuptools/__init__.pyc', '0.6c7')

But you really should avoid doing that if at all possible as that will install another older version of easy_install in /usr/local/bin and could cause problems with installing and using other packages.

Ned Deily
Thanks, I think this is going in the right direction. I ran the command you supplied, and I got the zlib error that I mentioned in The MYYN's answer.
That's rather odd. Try temporarily moving the site-packages directory out of the way: `sudo mv /Library/Python/2.6 /Library/Python/2.6_DISABLED` and make sure you have no `PYTHON*` or `DYLD*` environment variables set. And make sure your working directory is empty. Then try the `/usr/bin/python2.6` command above.
Ned Deily
Ok, I just ran the command again and got precisely the same output as you specified. However running the setup.py script while my 2.6 directory is in this renamed state gives the same error as my original post.
It would seem that somehow your default site-packages directory was messed up. If you have already installed other packages, you could try to repair it but it might be better at this point to clear it out and start over installing packages, so sudo mv /Library/Python/2.6_DISABLED /Library/Python/2.6 ; sudo rm -r /Library/Python/2.6/* Then see the updated answer above.
Ned Deily
Thanks so much Ned. Ultimately you were correct: it was a complicated mess of path issues. I made sure everything was pointing to the right place, and I'm good to go now.