tahoe-lafs / zfec

zfec -- an efficient, portable erasure coding tool
Other
374 stars 44 forks source link

pkg_resources.DistributionNotFound: The 'argparse>=0.8' distribution was not found and is required by zfec #50

Closed sajith closed 2 years ago

sajith commented 2 years ago

On IRC, jpds reported this:

$ tahoe
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.9/tahoe", line 33, in <module>
    sys.exit(load_entry_point('tahoe-lafs==1.15.1.post2033', 'console_scripts', 'tahoe')())
  File "/usr/lib/python-exec/python3.9/tahoe", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/lib/python3.9/site-packages/allmydata/scripts/runner.py", line 20, in <module>
    from twisted.internet import defer, task, threads
  File "/usr/lib/python3.9/site-packages/twisted/internet/defer.py", line 32, in <module>
    from twisted.logger import Logger
  File "/usr/lib/python3.9/site-packages/twisted/logger/__init__.py", line 93, in <module>
    from ._flatten import extractField
  File "/usr/lib/python3.9/site-packages/twisted/logger/_flatten.py", line 15, in <module>
    from ._interfaces import LogEvent
  File "/usr/lib/python3.9/site-packages/twisted/logger/_interfaces.py", line 10, in <module>
    from zope.interface import Interface
  File "/usr/lib/python3.9/site-packages/zope/__init__.py", line 1, in <module>
    __import__('pkg_resources').declare_namespace(__name__)
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3243, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3226, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3255, in _initialize_master_workin
g_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 568, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 886, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 772, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'argparse>=0.8' distribution was not found and is required by zfec

$ python
Python 3.9.5 (default, Jun 21 2021, 16:13:34)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import argparse
>>> argparse.__version__
'1.1'

It isn't clear to me how zfec is at fault here, because zfec is only asking for argparse >= 0.8, and argparse 1.1 appears to be available. Capturing for follow-up.

tomprince commented 2 years ago

argparse has been part of the standard library since 2.7, so there is no point in installing it.

Additionally, pip ignores installed copies of argparse (and wsgiref, see https://github.com/pypa/pip/issues/1570) when looking for installed packages. So if somebody tries to install zfec with pip install --no-index, it will fail, even if they have the unmaintained copy of argparse from pypi installed. Distributions will often do this, after ensuring that all the dependencies are involved.