0

For some reason I can't install anything with pip/pip3 lately. For example, when I try to install mendeley using the command "pip install mendeley", the following error message appears:

Traceback (most recent call last):
File "/Users/u1790509/anaconda3/bin/pip", line 11, in <module>
  load_entry_point('pip==10.0.1', 'console_scripts', 'pip')()
File "/Users/u1790509/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 480, in load_entry_point
  return get_distribution(dist).load_entry_point(group, name)
File "/Users/u1790509/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2691, in load_entry_point
  return ep.load()
File "/Users/u1790509/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2322, in load
  return self.resolve()
File "/Users/u1790509/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2328, in resolve
  module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Users/u1790509/anaconda3/lib/python3.6/site-packages/pip/_internal/__init__.py", line 42, in <module>
  from pip._internal import cmdoptions
File "/Users/u1790509/anaconda3/lib/python3.6/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
  from pip._internal.index import (
ImportError: cannot import name 'FormatControl'

The same error appears whenever I attempt to install packages using pip. Does anyone have any suggestion for fixing it?

thanks,

Stephen

Stephen Li
  • 29
  • 1
  • 2

1 Answers1

1

I was having this issue on systems running older versions of Anaconda and Python. Downgrading pip as per this answer and then upgrading it worked for me.

I ran:

conda install pip==9.0.3

pip install --upgrade pip

Then I was able to install the package I wanted to via pip install ....

I'm not sure what's going on behind the scenes since after downgrading from 10.x to 9.0.3, I still got:

Successfully uninstalled pip-20.0.2
Successfully installed pip-20.3.4

Probably a result of mixing Anaconda and pip for package management, but works for now for legacy purposes.

Andrew M.
  • 11
  • 1
  • LOL `pip install --upgrade pip` (your solution) gave me the same error that OP was getting: `ImportError: cannot import name 'FormatControl'`. However `conda install pip==9.0.3` didn't work for me because I don't have Conda, so maybe that's related. [Also related](https://stackoverflow.com/questions/26378344/how-to-know-the-version-of-pip-itself#comment132512773_26378395). – Nike Jan 12 '23 at 01:45