pip install fails with TypeError: identify() got an unexpected keyword argument 'requirement_or_candidate'

pip install fails with TypeError: identify() got an unexpected keyword argument 'requirement_or_candidate'

我最近使用自下而上的方法将我的 arch linux 安装移到了一台新机器上。 IE。新安装 arch linux,重新安装所有软件包,然后将选定的配置复制到新机器。

现在,当我尝试使用 pip 安装程序时,出现如下类型错误:

ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 224, in _main
    status = self.run(options, args)
  File "/usr/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
    return func(self, options, args)
  File "/usr/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 320, in run
    requirement_set = resolver.resolve(
  File "/usr/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 121, in resolve
    self._result = resolver.resolve(
  File "/home/mor3dr3ad/.local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 454, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/mor3dr3ad/.local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 319, in resolve
    name, crit = self._merge_into_criterion(r, parent=None)
  File "/home/mor3dr3ad/.local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 171, in _merge_into_criterion
    name = self._p.identify(requirement_or_candidate=requirement)
TypeError: identify() got an unexpected keyword argument 'requirement_or_candidate'

通过 sudo 以 root 身份安装确实有效(我知道我不应该这样做,只是为了测试。所以我认为这一定是由于权限问题或缺少组方面的某些内容。

任何人都可以指出我正确的方向吗?我需要将我的用户添加到某个组吗?

谢谢

您在 /home/mor3dr3ad/.local/lib/python3.9/site-packages/resolvelib/ 有一个本地安装的库 resolvelib。它似乎与 pip/usr/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib//usr/lib/python3.9/site-packages/pip/_vendor/resolvelib/.

销售的 resolvelib 不兼容

我的建议是卸载本地 resolvelib。尝试

pip uninstall resolvelib

PS。 sudo 很可能有效,因为它将用户切换到 root 并且用户在 /root/.local/lib/

没有本地包