0

Some of my python packages installed with pip had conflicts with another package I tried installing using pacman. So I decided to uninstall all the packages installed with pip. I made a requirements.txt file with all the packages and started uninstalling them. It worked fine for a while but eventually gave this error:

Traceback (most recent call last):
  File "/usr/bin/pip", line 11, in <module>
    load_entry_point('pip==10.0.1', 'console_scripts', 'pip')()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 479, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2703, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2321, in load
    return self.resolve()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2327, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3.6/site-packages/pip/_internal/__init__.py", line 42, in <module>
    from pip._internal import cmdoptions
  File "/usr/lib/python3.6/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
    from pip._internal.index import (
  File "/usr/lib/python3.6/site-packages/pip/_internal/index.py", line 15, in <module>
    from pip._vendor import html5lib, requests, six
ImportError: cannot import name 'requests'

I got a similar error everytime I tried running pip after that.

  • You probably got mismatched libraries built for different versions of python (as it may happen these days of switch from 3.6 to 3.7). You should just have needed to check python-requests dependencies. – mirh Oct 5 '18 at 23:51
0

Your problem is that you used sudo pip and ended up mixing-and-matching pacman packages and pip packages. Do not do this. If you need to use pip with a distribution installation of Python, use the --user flag, or better yet, a virtualenv.

In order to fix this, you need to uninstall everything you installed with pip, using e.g. the lostfiles package from the official repositories which will find files that pacman does not know about. Delete all this clutter, then use pacman to reinstall python-pip.

You may also need to check for packages with broken dependencies using pacman -Dk, or corrupted packages which have files you've deleted or replaced using pip which should belong to pacman, using pacman -Qkk.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.