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.

ImportError: cannot import name 'SourceDistribution' from 'pip._internal.distributions.source'

See original GitHub issue

Environment

CircleCI using Conda, eg https://circleci.com/gh/peterjc/thapbi-pict/1073

  • pip version: pip-19.2.3 (from conda) updated to 19.3 (via pip install --upgrade pip setuptools)
  • Python version: python-3.7.3
  • OS: Linux

I have made only minor changes to my code, but today the CircleCI builds broke during the build/install stage of my Python tool - multiple branches affected. The timing fits the release of pip 19.3 on PyPI.

Description

It appears a recent release of pip moved some internal files about, my guess is #6830.

Expected behavior

How to Reproduce

Full output on https://circleci.com/gh/peterjc/thapbi-pict/1073 which is running https://github.com/peterjc/thapbi-pict/blob/9fcec2da60e6e6ae5cf7ee6ad4b53dcc3a40cfe7/.circleci/config.yml#L56

...
python setup.py sdist --formats=gztar
python setup.py bdist_wheel
pip install dist/thapbi_pict-*.whl

Output

Traceback (most recent call last):
  File "/opt/conda/bin/pip", line 7, in <module>
    from pip._internal import main
  File "/opt/conda/lib/python3.7/site-packages/pip/_internal/__init__.py", line 40, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/opt/conda/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/opt/conda/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 11, in <module>
    from pip._internal.commands import (
  File "/opt/conda/lib/python3.7/site-packages/pip/_internal/commands/__init__.py", line 9, in <module>
    from pip._internal.commands.download import DownloadCommand
  File "/opt/conda/lib/python3.7/site-packages/pip/_internal/commands/download.py", line 10, in <module>
    from pip._internal.operations.prepare import RequirementPreparer
  File "/opt/conda/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 9, in <module>
    from pip._internal.distributions import (
  File "/opt/conda/lib/python3.7/site-packages/pip/_internal/distributions/__init__.py", line 1, in <module>
    from pip._internal.distributions.source import SourceDistribution
ImportError: cannot import name 'SourceDistribution' from 'pip._internal.distributions.source' (/opt/conda/lib/python3.7/site-packages/pip/_internal/distributions/source/__init__.py)
Exited with code 1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:60
  • Comments:101 (20 by maintainers)

github_iconTop GitHub Comments

131reactions
pradyunsgcommented, Jan 21, 2020

Thanks @PabloCastellano! I’m just ignoring comments here now, since I don’t want my heartrate going any higher. 😃

Made the bugfix release. If that helped, use 👍 on this post. Otherwise, please write a comment with the error message.

98reactions
PabloCastellanocommented, Jan 21, 2020

Please stop reporting “me too”. @pradyunsg is working on a fix right now

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: cannot import name 'SourceDistribution' from 'pip ...
under project name go to following file in virtual enviroment. venv\Lib\site-packages\pip_internal\distributions__init__.py comment out the ...
Read more >
cannot import name 'SourceDistribution' from 'pip._internal ...
We have tried upgrading our requirements to the latest but still the same error. The error seems out of our control. Could it...
Read more >
ImportError: cannot import name 'SourceDistribution' : PY-43386
ImportError : cannot import name 'SourceDistribution' ; Project, PyCharm ; Priority, Normal N ; Type, Bug ; State, Submitted S ; Assignee, Unassigned....
Read more >
pip commands fail with ImportError cannot import ... - SUSE
Running that command will work but should not be done, as next zypper update will apply based on previous version installed by zypper....
Read more >
cannot import name SourceDistribution - Launchpad Bugs
_internal.distributions.source import SourceDistribution 2020-01-21 12:36:28.000267 | primary | ImportError: cannot import name ...
Read more >

github_iconTop Related Medium Post

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