-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
C: direct urlDirect URL references (PEP 440, PEP 508, PEP 610)Direct URL references (PEP 440, PEP 508, PEP 610)C: editableEditable installationsEditable installationsC: freeze'pip freeze' related'pip freeze' relatedtype: bugA confirmed bug or unintended behaviorA confirmed bug or unintended behavior
Description
Environment
- pip version: 20.2.3
- Python version: 3.8
- OS: MacOS 10.15.7 and Ubuntu 20.04 (tested on two different machines)
I created the virtual environments with python3 -m venv ...
and populated them with flit install -s
(which installs a local script as "editable" analogously to python3 -m pip install --editable .
.
Description
When I run `python3 -m pip freeze' within the virtual environment, the following exception is raised:
ERROR: Exception:
Traceback (most recent call last):
File "/Users/tbaker/venvs/dcapenv/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 228, in _main
status = self.run(options, args)
File "/Users/tbaker/venvs/dcapenv/lib/python3.8/site-packages/pip/_internal/commands/freeze.py", line 101, in run
for line in freeze(**freeze_kwargs):
File "/Users/tbaker/venvs/dcapenv/lib/python3.8/site-packages/pip/_internal/operations/freeze.py", line 67, in freeze
req = FrozenRequirement.from_dist(dist)
File "/Users/tbaker/venvs/dcapenv/lib/python3.8/site-packages/pip/_internal/operations/freeze.py", line 257, in from_dist
req = direct_url_as_pep440_direct_reference(
File "/Users/tbaker/venvs/dcapenv/lib/python3.8/site-packages/pip/_internal/utils/direct_url_helpers.py", line 49, in direct_url_as_pep440_direct_reference
assert not direct_url.info.editable
AssertionError
@sbidoul @chrahunt I note that this assertion error was introduced a few months ago (see #7612).
Expected behavior
I expected pip to display a list of installed modules, as it does when I run pip 20.2.3 within virtual environments created prior to mid-August, e.g.:
alabaster==0.7.12
appdirs==1.4.4
astroid==2.4.2
attrs==19.3.0
Babel==2.8.0
black==19.10b0
How to Reproduce
- Go to a Github repo with a Python script under development - or clone the small project mklists that I used for this test (and note its pyproject.toml.
- Create a virtual environment, e.g.:
python3 -m venv .venv
- Activate the virtual environment, e.g.:
source .venv/bin/activate
(MacOS) or. .venv/bin/activate
(Ubuntu) - Install
flit
:python3 -m pip install --upgrade flit
- Run
flit install -s
to install the local code as "editable". - Run
python3 -m pip freeze
. - Instead of displaying a list of installed modules, an exception is raised (as described above).
Output (MacOS)
577 [master] ~/github/tombaker/mklists> python3 -m venv .venv
578 [master] ~/github/tombaker/mklists> source .venv/bin/activate
(.venv) 579 [master] ~/github/tombaker/mklists> python3 -m pip install --upgrade flit
Collecting flit
Using cached flit-3.0.0-py3-none-any.whl (48 kB)
... etc ...
Successfully installed certifi-2020.6.20 chardet-3.0.4 docutils-0.16 flit-3.0.0 flit-core-3.0.0 idna-2.10 pytoml-0.1.21 requests-2.24.0 urllib3-1.25.10
WARNING: You are using pip version 20.2.1; however, version 20.2.3 is available.
You should consider upgrading via the '/Users/tbaker/github/tombaker/mklists/.venv/bin/python3 -m pip install --upgrade pip' command.
(.venv) 580 [master] ~/github/tombaker/mklists> python3 -m pip install --upgrade pip
...
Successfully installed pip-20.2.3
(.venv) 581 [master] ~/github/tombaker/mklists> flit install -s
Extras to install for deps 'all': {'test', 'doc', '.none'} I-flit.install
Installing requirements I-flit.install
Collecting pytest
Using cached pytest-6.1.1-py3-none-any.whl (272 kB)
... etc ...
Successfully installed Jinja2-2.11.2 MarkupSafe-1.1.1 ... etc ...
Symlinking mklists -> /Users/tbaker/github/tombaker/mklists/.venv/lib/python3.8/site-packages/mklists I-flit.install
Writing script to /Users/tbaker/github/tombaker/mklists/.venv/bin/mklists I-flit.install
(.venv) 582 [master] ~/github/tombaker/mklists> python3 -m pip freeze
ERROR: Exception:
Traceback (most recent call last):
File "/Users/tbaker/github/tombaker/mklists/.venv/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 228, in _main
status = self.run(options, args)
File "/Users/tbaker/github/tombaker/mklists/.venv/lib/python3.8/site-packages/pip/_internal/commands/freeze.py", line 101, in run
for line in freeze(**freeze_kwargs):
File "/Users/tbaker/github/tombaker/mklists/.venv/lib/python3.8/site-packages/pip/_internal/operations/freeze.py", line 67, in freeze
req = FrozenRequirement.from_dist(dist)
File "/Users/tbaker/github/tombaker/mklists/.venv/lib/python3.8/site-packages/pip/_internal/operations/freeze.py", line 257, in from_dist
req = direct_url_as_pep440_direct_reference(
File "/Users/tbaker/github/tombaker/mklists/.venv/lib/python3.8/site-packages/pip/_internal/utils/direct_url_helpers.py", line 49, in direct_url_as_pep440_direct_reference
assert not direct_url.info.editable
AssertionError
Note
On 13 October, I described this issue on Stackoverflow
Metadata
Metadata
Assignees
Labels
C: direct urlDirect URL references (PEP 440, PEP 508, PEP 610)Direct URL references (PEP 440, PEP 508, PEP 610)C: editableEditable installationsEditable installationsC: freeze'pip freeze' related'pip freeze' relatedtype: bugA confirmed bug or unintended behaviorA confirmed bug or unintended behavior