Skip to content

extra incorrectly shown on installation error #13618

@notatallshaw

Description

@notatallshaw

Description

When you install a requirement with an extra and are no distributions for that extra you get a slightly misleading message from the installation error.

Expected behavior

Remove the extra from the requirement.

pip version

25.2

Python version

3.14

OS

Linux

How to Reproduce

pip install --dry-run fsrs[optimizer]==6.2.0

Output

Collecting fsrs==6.2.0 (from fsrs[optimizer]==6.2.0)
  Using cached fsrs-6.2.0-py3-none-any.whl.metadata (13 kB)
INFO: pip is looking at multiple versions of fsrs[optimizer] to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement torch; extra == "optimizer" (from fsrs[optimizer]) (from versions: none)
ERROR: No matching distribution found for torch; extra == "optimizer"

This line is confusing:

ERROR: No matching distribution found for torch; extra == "optimizer"

It comes directly from the distribution metadata and is used to refer to the fact that torch is an extra of fsrs, but taken out of that context it looks like pip is looking for torch with the extra optimizer. The message should read:

ERROR: No matching distribution found for torch

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: error messagesImproving error messagestype: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions