Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip list and pip freeze treat invalid packages differently #9235

Closed
eamars opened this issue Dec 7, 2020 · 2 comments
Closed

pip list and pip freeze treat invalid packages differently #9235

eamars opened this issue Dec 7, 2020 · 2 comments

Comments

@eamars
Copy link

eamars commented Dec 7, 2020

Environment

  • pip version: Up to 20.3.1
  • Python version: 3.7.7
  • OS: Windows 10 20H2

Description

Calling pip list will incorectly include invalid packages from site-packages folder. In contrast, pip freeze will report warnings and exclude them from the list.

Expected behavior

Package list reported by pip list and pip freeze should be consistent.

How to Reproduce

  1. Create a new virtual environment
  2. Install any package, rename the package_name.dist-info to ~package_name.dist-info
  3. Call pip list and pip freeze --all and observe the output.

Output
I renamed pandas-1.1.4.dist-info to ~pandas-1.1.4.dist-info as an example:

Output from pip list:

Package         Version
--------------- -------
-pandas         1.1.4
numpy           1.19.4
pip             20.3.1
python-dateutil 2.8.1
pytz            2020.4
setuptools      46.0.0
six             1.15.0
wheel           0.34.2

Output from pip freeze --all:

WARNING: Could not generate requirement for distribution -pandas 1.1.4 (c:\users\rbao\envs\temp3\lib\site-packages): Parse error at "'-pandas='": Expected W:(abcd...)
numpy==1.19.4
pip==20.3.1
python-dateutil==2.8.1
pytz==2020.4
setuptools==46.0.0
six==1.15.0
wheel==0.34.2

Notes the pandas is excluded from the pip freeze while included in pip list.

@uranusjr uranusjr changed the title Pip list incorrectly includes invalid packages pip list and pip freeze treat invalid packages differently Dec 7, 2020
@uranusjr uranusjr added the S: needs triage Issues/PRs that need to be triaged label Dec 7, 2020
@winsonluk
Copy link
Contributor

#9393 fixes this by ignoring warnings from packages with leading non-alphanumeric characters.

Also related to #7269, #7450, and a lot of other reports (e.g., https://stackoverflow.com/questions/59552380/pip3-warning-could-not-generate-requirement-for-distribution-ertifi-2019-11)

@DiddiLeija DiddiLeija added the S: awaiting response Waiting for a response/more information label Aug 26, 2021
@no-response
Copy link

no-response bot commented Sep 10, 2021

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@no-response no-response bot closed this as completed Sep 10, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2021
@pradyunsg pradyunsg removed S: needs triage Issues/PRs that need to be triaged S: awaiting response Waiting for a response/more information labels Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@uranusjr @eamars @pradyunsg @winsonluk @DiddiLeija and others