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

print setuptools.__file__ shows

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 <> wrote:
At 04:42 PM 1/12/2011 +0800, Pherl Liu wrote:

I got some error messages when using ez_setup to download and use the easy_install.

from ez_setup import 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 cannot be loaded from the egg?

Try running this script in your project directory:

  from ez_setup import 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.  ;-)