question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip 18.1: pipenv graph results in ImportError: cannot import name 'get_installed_distributions'

See original GitHub issue
Issue description

When you install pip 18.1 (not reproducible with pip 18.0 and below), pipenv graph fails with ImportError.

Expected result

I expect pipenv graph to work with no exceptions.

Actual result
$ 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'

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:10
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

19reactions
florislacommented, Oct 5, 2018

This is caused py pipenv not being compatible to the latest release of pip. #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 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
3reactions
joshnewlinatclearobjectcommented, Oct 9, 2018

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'
Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot import name 'project' from 'pipenv.core' - Stack Overflow
I'm trying to run a Python script on Pycharm but when I try to do pipenv install , I get this error cannot...
Read more >
pip 18.1: pipenv graph results in ImportError: cannot import ...
pip 18.1 : pipenv graph results in ImportError: cannot import name 'get_installed_distributions',I'mcurrentlyusingpython3 -m pip install ...
Read more >
pip 18.1: pipenv graph results in ImportError: cannot ... - 博客园
pip 18.1 : pipenv graph results in ImportError: cannot import name 'get_installed_distributions'. I'm currently using. python3 -m pip install pip ...
Read more >
Can't run pipenv dependencies: `ImportError: cannot import ...
Executed command: /usr/local/bin/pipenv graph --json. C detected. Error occurred: ImportError: cannot import name get_installed_distributions.
Read more >
pipenv Documentation - Read the Docs
You no longer need to use pip and virtualenv separately. They work together. ... Give you insight into your dependency graph (e.g. $...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found