Upgraded to Pylons==dev, getting traceback from pkg_resources

43 views
Skip to first unread message

Matt Feifarek

unread,
Jan 6, 2010, 12:13:45 AM1/6/10
to pylons-...@googlegroups.com
I upgraded a working Pylons 0.9.7 app to the new semantics from Pylons 1.0 (via pip install pylons==dev).

When I try to run the appserver, I get a traceback:

$ paster serve --reload localpylons.ini 
Traceback (most recent call last):
  File "/home/work/Mayhem/web/pylonsve/bin/paster", line 9, in <module>
    load_entry_point('PasteScript==1.7.3', 'console_scripts', 'paster')()
  File "/home/work/Mayhem/web/pylonsve/lib/python2.5/site-packages/paste/script/command.py", line 73, in run
    commands = get_commands()
  File "/home/work/Mayhem/web/pylonsve/lib/python2.5/site-packages/paste/script/command.py", line 115, in get_commands
    plugins = pluginlib.resolve_plugins(plugins)
  File "/home/work/Mayhem/web/pylonsve/lib/python2.5/site-packages/paste/script/pluginlib.py", line 81, in resolve_plugins
    pkg_resources.require(plugin)
  File "/home/work/Mayhem/web/pylonsve/lib/python2.5/site-packages/distribute-0.6.8-py2.5.egg/pkg_resources.py", line 633, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/work/Mayhem/web/pylonsve/lib/python2.5/site-packages/distribute-0.6.8-py2.5.egg/pkg_resources.py", line 531, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: Not Found: Pylons-0.9.7-py2.5 (did you run python setup.py develop?)

I most certainly did setup.py develop.

Grepping for "0.9.7" in the site-packages in my virtual env only finds instances in various doc files.

If I move the "Pylons-0.9.7-py2.5.egg-info" back into my site-packages (but leave the actual pylons module at the dev tip) then my app will launch.

Obviously, some library somewhere is requiring exactly the 0.9.7 egg, but the traceback is SO BAD that I can't even tell what library is looking for that version pf Pylons (XXX put more info here).

I'm developing again, but I don't like that cruft in my site-packages... does anyone have a clue on what might be stubborn about the Pylons version?

Matt Feifarek

unread,
Jan 6, 2010, 12:45:33 AM1/6/10
to pylons-...@googlegroups.com
On Tue, Jan 5, 2010 at 11:13 PM, Matt Feifarek <matt.f...@gmail.com> wrote:
I upgraded a working Pylons 0.9.7 app to the new semantics from Pylons 1.0 (via pip install pylons==dev).

When I try to run the appserver, I get a traceback:

Here's an easily reproducible case:

work@dude:~$ virtualenv --distribute --no-site-packages -p /usr/bin/python2.5 froon
/usr/local/bin/virtualenv:5: UserWarning: Module pkg_resources was already imported from /usr/lib/python2.6/dist-packages/pkg_resources.pyc, but /usr/local/lib/python2.6/dist-packages is being added to sys.path
  from pkg_resources import load_entry_point
/usr/local/bin/virtualenv:5: UserWarning: Module site was already imported from /usr/lib/python2.6/site.pyc, but /usr/local/lib/python2.6/dist-packages is being added to sys.path
  from pkg_resources import load_entry_point
Running virtualenv with interpreter /usr/bin/python2.5
New python executable in froon/bin/python2.5
Also creating executable in froon/bin/python
Installing distribute...........................................................................................................................................................................done.

work@dude:~$ cd froon

work@dude:~/froon$ source bin/activate

(froon)work@dude:~/froon$ pip install pylons==dev
    [ lots of stuff happens here ]
Successfully installed Beaker decorator FormEncode Mako nose Paste PasteDeploy PasteScript Pygments pylons Routes simplejson Tempita WebError WebHelpers WebOb WebTest

(froon)work@dude:~/froon$ paster create -t pylons oof
Traceback (most recent call last):
  File "/home/work/froon/bin/paster", line 9, in <module>
    load_entry_point('PasteScript==1.7.3', 'console_scripts', 'paster')()
  File "/home/work/froon/lib/python2.5/site-packages/paste/script/command.py", line 73, in run
    commands = get_commands()
  File "/home/work/froon/lib/python2.5/site-packages/paste/script/command.py", line 115, in get_commands
    plugins = pluginlib.resolve_plugins(plugins)
  File "/home/work/froon/lib/python2.5/site-packages/paste/script/pluginlib.py", line 81, in resolve_plugins
    pkg_resources.require(plugin)
  File "/home/work/froon/lib/python2.5/site-packages/distribute-0.6.8-py2.5.egg/pkg_resources.py", line 633, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/work/froon/lib/python2.5/site-packages/distribute-0.6.8-py2.5.egg/pkg_resources.py", line 531, in resolve

Mike Orr

unread,
Jan 6, 2010, 1:13:17 AM1/6/10
to pylons-...@googlegroups.com

That's what I hate about Paste and entry points and pkg_resources.
These errors occur and can be impossible to trace because the
traceback doesn't tell you who's asking for the package. You can try
the Python debugger but the error is probably way down in a
sys.path/entry point loop somewhere. I don't remember if the debugger
will actually break there or sail through it.

The most likely place is in your application's setup.py or its
egg-info. Reinstalling the application (which regenerates its
egg-info) may fix it. You may have to manually delete the
application's .egg-link file and its entry in easy_install.pth before
reinstalling; sometimes that clears it up. And ditto for Pylons'
egg-link and easy_install.pth entry.

Also look for any script in your bin directory that has an absolute
path to a certain Python interpreter or requires that Pylons version.

My colleague Chris always says, "Why doesn't Pylons/Paste just try to
import something before requiring it? That would avoid a lot of
problems if the import works but the metadata situation is slightly
off."

--
Mike Orr <slugg...@gmail.com>

Matt Feifarek

unread,
Jan 6, 2010, 12:00:46 PM1/6/10
to pylons-...@googlegroups.com
On Wed, Jan 6, 2010 at 12:13 AM, Mike Orr <slugg...@gmail.com> wrote:
That's what I hate about Paste and entry points and pkg_resources.

+ 1Jillion.

Thanks for your suggestions. I tried all of those things; I even removed the version numbers in my app (from Pylons>=0.9.7 to just Pylons) but no-go.

The fact that this happens on a FRESH install of Pylons right from pip without an app even installed means that this is a bug. One can't install tip and make a pylons template; it has nothing to do with my app.

I agree with your colleague. It is SO frustrating to see the package right there in the site-packages, but not be able to fix it.

Thanks for the advice.
Reply all
Reply to author
Forward
0 new messages