When you install pip 18.1 (not reproducible with pip 18.0 and below), pipenv graph
fails with ImportError
.
I expect pipenv graph
to work with no exceptions.
$ pipenv graph
Traceback (most recent call last):
File ".../.local/lib/python3.6/site-packages/pipenv/vendor/pipdeptree.py", line 17, in <module>
from pip._internal import get_installed_distributions
ImportError: cannot import name 'get_installed_distributions'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".../.local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File ".../.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File ".../.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File ".../.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File ".../.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File ".../.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File ".../.local/lib/python3.6/site-packages/pipenv/cli.py", line 922, in graph
do_graph(bare=bare, json=json, json_tree=json_tree, reverse=reverse)
File ".../.local/lib/python3.6/site-packages/pipenv/core.py", line 2363, in do_graph
import pipdeptree
File ".../.local/lib/python3.6/site-packages/pipenv/vendor/pipdeptree.py", line 20, in <module>
from pip import get_installed_distributions, FrozenRequirement
ImportError: cannot import name 'get_installed_distributions'
This is caused py pipenv
not being compatible to the latest release of pip
.
The workaround that works there is valid for this issue downgrade your pip
to a version prior to 18.1
.
I'm currently using
python3 -m pip install pip==10.0.1
python3 -m pip install pipenv==2018.5.18
Once #2924 is fixed and released, you can upgrade again to the latest and greatest.
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pipenv
Depending on whether this is fixed upstream we can either patch this or upgrade
I was looking into how pip is used in Pipenv, and this one is actually different from #2924. We鈥檝e migrated to pip-shims in most code paths, but pipenv graph
uses an (rather obscure) code path that imports pip directly. We鈥檒l need to patch pipdeptree
to fix this.
It's been fixed in pipdeptree version 0.13.1.
https://github.com/naiquevin/pipdeptree/commit/ba67474e41aacfacd3811cb1f0dd5a16dc6251c8
Ah, excellent!
fixed in master as well, thanks for the quick turn around @naiquevin
also released
I upgraded pipenv and currently have the following versions:
$ python --version
Python 2.7.12
$ pipenv --version
pipenv, version 2018.10.9
$ pip --version
pip 18.1 from /home/coolcude/.local/lib/python2.7/site-packages/pip (python 2.7)
Since it was released I assume it would have been fixed in 2018.10.9? I still get:
$ pipenv graph
ERROR: Traceback (most recent call last):
File "/home/cooldude/.local/lib/python2.7/site-packages/pipenv/vendor/pipdeptree.py", line 16, in <module>
from pipenv.vendor.pip_shims import get_installed_distributions, FrozenRequirement
ImportError: No module named pipenv.vendor.pip_shims
I'm getting a similar issue to @thernstig above. Just updated this morning.
$ python --version
Python 3.6.5
$ pipenv --version
pipenv, version 2018.10.9
$ pip --version
pip 18.1 from /usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pip (python 3.7)
Error below:
$ pipenv graph
ERROR: Traceback (most recent call last):
File "/usr/local/Cellar/pipenv/2018.10.9/libexec/lib/python3.7/site-packages/pipenv/vendor/pipdeptree.py", line 16, in <module>
from pipenv.vendor.pip_shims import get_installed_distributions, FrozenRequirement
ModuleNotFoundError: No module named 'pipenv'
@thernstig @joshnewlinatclearobject See #2952.
Most helpful comment
This is caused py
pipenv
not being compatible to the latest release ofpip
.2924 is another error cause by the same issue.
The workaround that works there is valid for this issue downgrade your
pip
to a version prior to18.1
.I'm currently using
Once #2924 is fixed and released, you can upgrade again to the latest and greatest.