Pip: The 'pip==19.0.2' distribution was not found and is required by the application

Created on 10 Apr 2019  路  7Comments  路  Source: pypa/pip

Environment

  • pip version: 19.0.3
  • Python version: 3.7
  • OS: Mac OS Mojave 10.14.4

Description

python installed with homebrew

running pip -v or pip upgrade or anything else with pip

  1. Get package from home-brew
  2. Then run pip
  3. An error occurs.

Output

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 791, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pip 19.0.3 (/usr/local/lib/python3.7/site-packages), Requirement.parse('pip==19.0.2'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/opt/python/libexec/bin/pip", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3191, in <module>
    @_call_aside
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3175, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3204, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 585, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==19.0.2' distribution was not found and is required by the application
macos downstream auto-locked

Most helpful comment

This is an ongoing problem caused by homebrew, occurs when you upgrade pip. As @pfmoore said the pip executable file provided by homebrew is the culprit, it has a hardcoded pip version requirement in it.
The easiest way is to just run brew reinstall python to fix this problem.
You can try pip install pip --upgrade afterwards and break it again to confirm.

All 7 comments

I'm with the same problem

I also have the same issue

This looks like an issue in /usr/local/opt/python/libexec/bin/pip which presumably is supplied by homebrew, so I'd suggest raising an issue with them. It looks like you have a copy of that file from pip 19.0.2, but have pip 19.0.3 installed.

u can check it first by

which pip3

mine is /usr/local/bin instead of /usr/bin
and that's the problem.
so i do as the follow:

  1. sudo rm -rf /usr/local/bin/pip3

  2. sudo ln -s /usr/local/your_python_path/bin/pip3 /usr/local/bin/pip3

  3. pip3 -version

This is an ongoing problem caused by homebrew, occurs when you upgrade pip. As @pfmoore said the pip executable file provided by homebrew is the culprit, it has a hardcoded pip version requirement in it.
The easiest way is to just run brew reinstall python to fix this problem.
You can try pip install pip --upgrade afterwards and break it again to confirm.

I found that:
easy_install pip
worked for me

Closing since there's nothing actionable here. Homebrew should fix this issue on their end.

Was this page helpful?
0 / 5 - 0 ratings