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

Warnings for skipped <pkg>.dist-info are unclear when METADATA file is missing #12446

Open
1 task done
zanieb opened this issue Dec 20, 2023 · 3 comments
Open
1 task done
Labels
C: error messages Improving error messages good first issue A good item for first time contributors to work on type: enhancement Improvements to functionality

Comments

@zanieb
Copy link

zanieb commented Dec 20, 2023

Description

When you uninstall a package with extra files (as described in #12445) you can end up in a bad state where pip warns due to the existence of an invalid dist-info directory e.g.

WARNING: Skipping .venv/lib/python3.11/site-packages/idna-3.6.dist-info due to invalid metadata entry 'name'

However, this warning is shown in cases where there is no METADATA file at all and it's not clear how to resolve this as a user.

Expected behavior

Instead of suggesting that the metadata has an invalid 'name', the warning should suggest that the dist-info is invalid

WARNING: Skipping .venv/lib/python3.11/site-packages/idna-3.6.dist-info due to invalid due to missing METADATA file

Perhaps there's even a better user experience to be had here? Curious to hear others' thoughts.

pip version

23.3.2

Python version

3.11.4

OS

macOS

How to Reproduce

Here, we construct a bad dist-info entry manually though a user can get in this state accidentally without editing site-packages.

python -m venv .venv
source .venv/bin/activate
python -m pip install pip==23.3.2 > /dev/null 2>&1

set -eux

SITE_PACKAGES=$(python -c 'import site; print(site.getsitepackages()[0])')

# Create a bad dist-info entry
mkdir -p $SITE_PACKAGES/foo.dist-info
touch $SITE_PACKAGES/foo.dist-info/FOO

# Warning is not clear during `pip` command
pip list

rm -rf .venv

Output

++ python -c 'import site; print(site.getsitepackages()[0])'
+ SITE_PACKAGES=.venv/lib/python3.11/site-packages
+ mkdir -p .venv/lib/python3.11/site-packages/foo.dist-info
+ touch .venv/lib/python3.11/site-packages/foo.dist-info/FOO

+ pip list
WARNING: Skipping .venv/lib/python3.11/site-packages/foo.dist-info due to invalid metadata entry 'name'
Package    Version
---------- -------
pip        23.3.2
setuptools 65.5.0

+ rm -rf .venv

Code of Conduct

@zanieb zanieb added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Dec 20, 2023
@uranusjr uranusjr added type: enhancement Improvements to functionality C: error messages Improving error messages good first issue A good item for first time contributors to work on and removed type: bug A confirmed bug or unintended behavior S: needs triage Issues/PRs that need to be triaged labels Apr 3, 2024
@TishyaaChaudhry
Copy link

I would like to work on this if it is still open

@sanspareilsmyn
Copy link

Is it fixed? If it's not, I would love to contribute on it:)

@uranusjr
Copy link
Member

No PR linked so I assume this is open. Feel free.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: error messages Improving error messages good first issue A good item for first time contributors to work on type: enhancement Improvements to functionality
Projects
None yet
Development

No branches or pull requests

4 participants