Reputation: 25191
Example of installing something in clean venv:
$ rm -rf venv && python3.8 -m venv venv && ./venv/bin/python -m pip install -U pip && ./venv/bin/python -m pip install requests
Collecting pip
Using cached https://files.pythonhosted.org/packages/60/65/16487a7c4e0f95bb3fc89c2e377be331fd496b7a9b08fd3077de7f3ae2cf/pip-20.0-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
Successfully uninstalled pip-19.2.3
Successfully installed pip-20.0
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
...
File "/Users/messa/test/venv/lib/python3.8/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' (/Users/messa/test/venv/lib/python3.8/site-packages/pip/_internal/distributions/source/__init__.py)
Upvotes: 4
Views: 4031
Reputation: 25191
Current pip version 20.0 is broken - see https://github.com/pypa/pip/issues/7620
Install pip other than 20.0:
$ pip install -U "pip!=20.0"
Update: pip 20.0.1 was released that fixes this issue.
If you are stuck with 20.0 and cannot upgrade to 20.0.1 because of this error, try get-pip.py
or easy_install
.
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python get-pip.py --ignore-installed
Upvotes: 8
Reputation: 1203
A quick fix have been made now. Nothing to change. You can use last version of pip
On my side everything is okay
https://github.com/pypa/pip/issues/7217
Upvotes: 0