pkg_resources.DistributionNotFound: argparse on RHEL-based distros #111

Closed
stemid opened this Issue Jul 9, 2015 · 5 comments

Comments

3 participants
Contributor

stemid commented Jul 9, 2015

$ tmuxp
Traceback (most recent call last):
  File "/usr/bin/tmuxp", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2655, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 648, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 546, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: argparse

This would seem like a bug in RHEL-based distros but all the fixes I've seen for this have been from package maintainers, and not from the distro.

I wish I knew what they did to fix it, or I would contribute. But I don't understand what the fix is, I can just see that several other packages run into this problem on RHEL-based distros.

I've tried on Fedora 22, CentOS 7 and RHEL 6.

$ python
Python 2.7.5 (default, Jun 24 2015, 00:41:19)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
>>> pkg_resources.get_distribution('argparse')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 371, in get_distribution
    if isinstance(dist,Requirement): dist = get_provider(dist)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 243, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 728, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 626, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: argparse
>>> import argparse
>>> argparse.__version__
'1.1'
Owner

tony commented Jul 9, 2015

This does seem to be a issue that exists. I have some a bit of digging, but not sure if it's a problem on tmuxp's end of things (or one of it's dependencies) or not.

See also: elastic/curator#56

Does pip install -U setuptools do anything to help?

Contributor

stemid commented Jul 9, 2015

Yes it does @tony! Problem solved I think.

I tried first to upgrade setuptools on Fedora 22, and tmuxp sprang to life. Then I tried on RHEL6 and same there, tmuxp started working.

Thanks for your assistance.

bulak commented Jul 9, 2015

Not sure if it's relevant but in your example pkg_resources is loaded from python2.6 where argparse does not exists, min version is 2.7. Upgrading should help with your probem, no?

Owner

tony commented Jul 10, 2015

We should probably add something to the docs for Fedora / Redhat / CentOS users who may encounter this problem. A .. note:: in https://github.com/tony/tmuxp/blob/master/doc/quickstart.rst may be a good spot. @stemid Want to give it a shot?

Owner

tony commented Aug 3, 2015

Fixed in #112

@tony tony closed this Aug 3, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment