无法安装本地 python 包

Can't install local python package

经过几次系统升级后,我无法再安装我的 Python 3 软件包。这是输出:

    pab@pab:~/Mopiqtt-1.0.0 $ sudo pip3 install .
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing /home/pab/Mopiqtt-1.0.0
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/home/pab/Mopiqtt-1.0.0/setup.py", line 46, in <module>
          'mqtt = mopiqtt:Extension',
        File "/usr/local/lib/python3.7/dist-packages/setuptools/__init__.py", line 86, in setup
          _install_setup_requires(attrs)
        File "/usr/local/lib/python3.7/dist-packages/setuptools/__init__.py", line 75, in _install_setup_requires
          dist = MinimalDistribution(attrs)
        File "/usr/local/lib/python3.7/dist-packages/setuptools/__init__.py", line 57, in __init__
          super().__init__(filtered)
        File "/usr/local/lib/python3.7/dist-packages/setuptools/dist.py", line 475, in __init__
          for ep in metadata.entry_points(group='distutils.setup_keywords'):
        File "/usr/local/lib/python3.7/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 999, in entry_points
          return SelectableGroups.load(eps).select(**params)
        File "/usr/local/lib/python3.7/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 449, in load
          ordered = sorted(eps, key=by_group)
        File "/usr/local/lib/python3.7/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 997, in <genexpr>
          dist.entry_points for dist in unique(distributions())
        File "/usr/local/lib/python3.7/dist-packages/setuptools/_vendor/importlib_metadata/_itertools.py", line 16, in unique_everseen
          k = key(element)
        File "/usr/local/lib/python3.7/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 931, in _normalized_name
          return self._name_from_stem(stem) or super()._normalized_name
        File "/usr/local/lib/python3.7/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 600, in _normalized_name
          return Prepared.normalize(self.name)
        File "/usr/local/lib/python3.7/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 855, in normalize
          return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
        File "/usr/lib/python3.7/re.py", line 192, in sub
          return _compile(pattern, flags).sub(repl, string, count)
      TypeError: expected string or bytes-like object
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

我正在为此苦苦挣扎,找不到解决方案。相关包版本:

pip                    22.1.1
setuptools             62.3.2
ez-setup               0.9

感谢您的帮助。

[编辑}:同样的问题,如果我 运行 python3 setup.py check

我已经通过降级 setuptools 解决了这个问题:

pip3 install --force-reinstall setuptools==40.8.0

但我不知道这个错误....