Lee.Tan
Lee.Tan

Reputation: 619

pkg_resources.DistributionNotFound: The 'pipenv==2018.10.13' distribution was not found and is required by the application

I've reinstalled pip and pipenv due to some broken package with ansible. Now, it seems like my pip dependencies are all screwed. Any suggestion or help is greatly appreciated.

$ which python2
 /usr/local/bin/python2

$ which python3
/usr/local/bin/python3

$ which pipenv
/usr/local/bin/pipenv


Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2018.10.13/libexec/bin/pipenv", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3123, in <module>
    @_call_aside
  File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3107, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3136, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 580, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 593, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 781, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pipenv==2018.10.13' distribution was not found and is required by the application

Upvotes: 37

Views: 32459

Answers (4)

Rakshyak Satpathy
Rakshyak Satpathy

Reputation: 1

first go to the virtual env directory by typing below command on the terminal

cd ~/.local/share/virtualenvs/

then check for a directory having project name as prefix, and open terminal inside that directory and type

mkdir bin; cp local/bin/python bin/

after this go the the your project directory and run pipenv install again.

Upvotes: 0

Switnex XTra
Switnex XTra

Reputation: 11

if you get this kind of "pkg_resources.DistributionNotFound: The 'filelock<4,>=3.4.1' distribution was not found and is required by virtualenv" error you can also solve it by navigating to the folder and then run "pip install pipenv"

Upvotes: 0

Leo Borai
Leo Borai

Reputation: 2509

I had the same problem. You should reinstall pipenv using the same package manager you used the first time.

  • If the installation was done using pip, then:

    pip uninstall pipenv
    pip install pipenv
    
  • If you are using brew, then you must run the commands exposed by Andrei

    brew uninstall pipenv
    brew install pipenv
    

To check if pipenv installation was successfully completed, run: pipenv --version

From the comments, alternatively use:

brew reinstall pipenv

Upvotes: 84

Filippo Vitale
Filippo Vitale

Reputation: 8113

This should fix the problem too:

pipenv --rm
pipenv check
pipenv sync

I run into this problem from time to time when updating python using anaconda.

Upvotes: 5

Related Questions