Well.. I think I can fix this by editing ez_setup.py adding oneline after pkg_resources.DistributionNotFound is caught, in use_setuptools() del pkg_resources, sys.modules['pkg_resources'] Not sure if this makes sense. A patch based on 0.6c9. diff --git a/python/ez_setup.py b/python/ez_setup.py index b7a9849..cef3557 100755 --- a/python/ez_setup.py +++ b/python/ez_setup.py @@ -113,6 +113,7 @@ def use_setuptools( del pkg_resources, sys.modules['pkg_resources'] # reload ok return do_download() except pkg_resources.DistributionNotFound: + del pkg_resources, sys.modules['pkg_resources'] # reload ok return do_download() On Wed, Jan 19, 2011 at 2:43 PM, Pherl Liu <liujisi@google.com> wrote:
print sys.path shows the egg is the first item. ['setuptools-0.6c9-py2.6.egg', '', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', ....]
print pkg_resources.__file__ shows /usr/lib/python2.6/dist-packages/pkg_resources.pyc
print setuptools.__file__ shows setuptools-0.6c9-py2.6.egg/setuptools/__init__.py
Hmm, then it's strange.. Kenton (cc-ed) also got the same problem when running this on Ubuntu + python 2.6. The pkg_resources is from /usr/lib/python2.6/dist-packages/, while the egg should have a higher import priority than /usr/lib/python2.6/dist-packages in sys.path...
On Fri, Jan 14, 2011 at 10:45 PM, P.J. Eby <pje@telecommunity.com> wrote:
At 04:42 PM 1/12/2011 +0800, Pherl Liu wrote:
Hi,
I got some error messages when using ez_setup to download and use the easy_install.
# setup.py from ez_setup import use_setuptools use_setuptools()
from setuptools import setup
setup(name = "blabla", test_suite = "some_test", namespace_package = ["some_namespace"], # many other options )
So I guess there might be some import problem in my machine (ubuntu lucid) that the pkg_resources.py cannot be loaded from the egg?
Try running this script in your project directory:
from ez_setup import use_setuptools use_setuptools()
import sys, setuptools, pkg_resources print sys.path print pkg_resources.__file__ print setuptools.__file__
This should tell us what's going on with your "import problem" more specifically. ;-)