pipenv==2018.11.26' distribution was not found

Created on 12 Nov 2019  路  7Comments  路  Source: pypa/pipenv

Hello,

I used pipenv to create python virtual environments but it is not working anymore. When I run pipenv --version it outputs the message below.
I uninstalled it already and installed a clean version with homebrew but nothing has changed.
Do we know how to solve this issue?

Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2018.11.26_2/libexec/bin/pipenv", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/Users/joana.pinto/.pyenv/versions/3.7.4/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3191, in <module>
    @_call_aside
  File "/Users/joana.pinto/.pyenv/versions/3.7.4/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3175, in _call_aside
    f(*args, **kwargs)
  File "/Users/joana.pinto/.pyenv/versions/3.7.4/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3204, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/Users/joana.pinto/.pyenv/versions/3.7.4/lib/python3.7/site-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/Users/joana.pinto/.pyenv/versions/3.7.4/lib/python3.7/site-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/Users/joana.pinto/.pyenv/versions/3.7.4/lib/python3.7/site-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pipenv==2018.11.26' distribution was not found and is required by the application
Status Needs More Information

Most helpful comment

@joanap, I run into the same issue every now and then. Never got a chance to dig deep in to why this is happening. Every time I ran into this error, I find $ brew reinstall pipenv fixes the issue. You can probably try that to unblock yourself.

I am not exactly sure whether this is Pipenv's issue or Homebrew's.

All 7 comments

Check your path setting, you made pyenv's python take precedence over the brew one.

I want to use the python from pyenv.

Output of the echo $PATH command:
/Users/joana.pinto/.pyenv/shims:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/joana.pinto/.pyenv/shims:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/joana.pinto/.pyenv/shims:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/joana.pinto/.pyenv/shims:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/joana.pinto/.pyenv/shims:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/joana.pinto/.pyenv/shims:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

@joanap, I run into the same issue every now and then. Never got a chance to dig deep in to why this is happening. Every time I ran into this error, I find $ brew reinstall pipenv fixes the issue. You can probably try that to unblock yourself.

I am not exactly sure whether this is Pipenv's issue or Homebrew's.

@hanpeter I would like to be able to install several Python versions with pyenv and create virtual environments with pipenv. I already tried reinstall and uninstall pipenv with brew but the error persists.

Here are some variables:
$ echo $PATH
/Users/joana.pinto/.pyenv/shims:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

I realised pipenv installed with brew it is not inside pyenv
$ which pipenv
/usr/local/bin/pipenv

$ which pyenv
/usr/local/bin/pyenv

$ which python
/Users/joana.pinto/.pyenv/shims/python

@joanap, your stack trace says your pipenv executable is coming from Homebrew's cellar. That is very confusing to me. If you want to use pyenv's python, wouldn't you just do $ pip install pipenv in the virtual environment created by pyenv?

In my current set up, I installed pipenv and pyenv from Homebrew. I have multiple version of python via pyenv. When I want to create a virtual environment using a version of python, I do $ pipenv --python X.Y.Z. Sure, my pipenv lives on my system rather than within a virtual environment, but I trust Homebrew to handle that properly. I believe this set up gives you what you are looking for.

Alternatively, I believe you can set a global version in your pyenv then install pipenv via pip in that version. Then you should be able to do the same as above, if you are in the global version. In other words, if you have Python 3.6 and 3.7 installed and use 3.6 as the global version, you should be able to do $ pipenv --python 3.7 as long as you are currently using the 3.6 version.

Hope that clarifies what you are looking for.

I think this is the same as https://github.com/pypa/pipenv/issues/4013

I ran into the exact same issue right after reinstalling node with brew. brew reinstall pipenv fixed the issue for me, as described by @hanpeter.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeyraof picture jeyraof  路  3Comments

jakul picture jakul  路  3Comments

AkiraSama picture AkiraSama  路  3Comments

erinxocon picture erinxocon  路  3Comments

jacebrowning picture jacebrowning  路  3Comments