PyPM Error: pkg_resources.DistributionNotFound

Posted by quilmach on 2013-09-05 12:08
Forums: PyPM (discontinued) | OS: Windows 7

Help, I was able to use PyPM just fine until today when I installed gevent via a Windows installer (PyPM did not have it in the list of packages, so I had to do this "manual" install). After this PyPM stopped working. Now I am getting the following error. Any ideas how to fix?

Traceback (most recent call last):
File "C:\Python27\Scripts\pypm-script.py", line 5, in
from pkg_resources import load_entry_point
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2607, in
parse_requirements(__requires__), Environment()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: setuptools>=0.7

sridharr
ActiveState Staff
Thu, 2013-09-05 12:22

what is your ActivePython version? 32-bit or 64-bit install?

try this:

* download https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py

* open command prompt, and run this script as "python ez_setup.py"

let me know what happens if you re-run pypm.

quilmach | Thu, 2013-09-05 12:41

Thanks for your help. I am using the 32 Bit version. I tried your link and ez_install finished okay. Now when I try PyPM I get this message:
...
Installing easy_install-2.7.exe.manifest script to c:\Python27\Scripts

Installed c:\python27\lib\site-packages\setuptools-1.1.1-py2.7.egg
Processing dependencies for setuptools==1.1.1
Finished processing dependencies for setuptools==1.1.1

c:\Python27>pypm
error: incompatible "setuptools" package found at "C:\Python27\lib
\site-packages\setuptools-1.1.1-py2.7.egg\setuptools\__init__.pyc".

* * *
To install packages properly, PyPM requires the Distribute package.
Distribute is a fork of the common "setuptools" package developed by
the Python community to fix various bugs. It is fully backward
compatible with "setuptools". ActiveState recommends that all users
switch from setuptools to Distribute.

This ActivePython installation already includes Distribute. However
there is a conflicting "setuptools" installation in the way. Most
likely this is from having installed ActivePython over a pre-existing
Python site-packages area. To use PyPM you must remove (or rename) the
setuptools ".egg" directory. You can run the following to do that,
then re-run your pypm command:

ren "C:\Python27\lib\site-packages\setuptools-1.1.1-py2.7.egg"
"C:\Python27\lib\site-packages\setuptools-1.1.1-py2.7.egg.bak"

See the ActivePython FAQ for more information:
http://docs.activestate.com/activepython/2.7/faq.html#pypm
* * *

quilmach | Thu, 2013-09-05 12:44

Also, if I rename as suggested I get back the original error.

sridharr
ActiveState Staff
Thu, 2013-09-05 13:22

Don't rename! revert your rename, and ...

edit c:\python27\lib\site-packages\pypm\__init__.py and replace "if not getattr(setuptools, '_distribute', False):" with "if False and not getattr(setuptools, '_distribute', False):" and let me know what happens. be sure to make a backup of this file before editing.

quilmach | Thu, 2013-09-05 14:16

Awesome. That did it. Not sure what your change accomplished (and I am curious :), but it worked! Thanks so much.

sridharr
ActiveState Staff
Thu, 2013-09-05 16:30

pypm is incompatible with setuptools-0.x (hence that check) - except for the recently released setuptools-1.x. future versions of ActivePython will have this check removed, along with including setuptools-1.x so you don't have to do all of this yourself.