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

Viewed 2650

i have recently moved my arch linux installation to a new machine using a bottom to top approach. I.e. new install of arch linux, reinstallation of all packages and then copying selected configs to the new machine.

Now when I try to install a program with pip, I get a TypeError like so:

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'

Installing as root via sudo actually works (I know I should not be doing this, just for testing. So I am thinking that it must be due to a permission issue or missing something in terms of groups.

Can anybody point me in the right direction? Do I need to add my user to a certain group?

Thank you

1 Answers

You have a locally installed library resolvelib at /home/mor3dr3ad/.local/lib/python3.9/site-packages/resolvelib/. It seems it's incompatible with pip vendored resolvelib at /usr/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/ and /usr/lib/python3.9/site-packages/pip/_vendor/resolvelib/.

My advice is to uninstall local resolvelib. Try

pip uninstall resolvelib

PS. Most probably sudo works because it switches the user to root and the user doesn't have local packages at /root/.local/lib/

Related