Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve warnings when invalid/broken installed packages are detected #13638

@ichard26

Description

@ichard26

Raising a proper diagnostic here would be good. However, it may be better to detect and warn/error out on invalid metadata in a centralized manner. IMO we should start flagging missing or malformed installed distribution metadata more aggressively to A) provide context when pip inevitably crashes/misbehaves, and B) encourage standards compliance. Some issues to flag (which pip may be able to flag already or not) include:

  • Missing core metadata fields (name, version)
  • Mismatches between distribution metadata directory name and core metadata
  • Invalid core metadata values -- this is likely just a matter of making sure whatever error packaging raises is handled appropriately
  • Duplicate installations (indicated by duplicate dist-info directories)1
  • Missing installation metadata files (METADATA, RECORD)
  • Flagging incomplete uninstalls -- pip already warns on these invalid distributions, but it should notice the atypical prefix (~ or - IIRC?) and inform the user that it's likely an uninstall that failed midway through (and can be safely removed)

This should probably be broken out into its own issue. If we agree this is worthwhile, of course.

Originally posted by @ichard26 in #13458

Footnotes

  1. We can only warn if the duplicate installations are contained within the same import path. Overriding installations via sys.path ordering can be and is done in practice (even pip's build isolation logic does it).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions