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...
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:import sys, setuptools, pkg_resources
from ez_setup import use_setuptools
use_setuptools()
print sys.path
print pkg_resources.__file__
print setuptools.__file__
This should tell us what's going on with your "import problem" more specifically. ;-)