python config_error ai_generated true

WARNING: mypkg 1.0 does not provide the extra 'dev'

ID: python/setuptools-missing-extras-requires

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
0Evidence
2024-06-08First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active

Root Cause

The package metadata does not declare the requested extra in extras_require or [project.optional-dependencies], so pip installs only the base package.

generic

中文

包元数据未在 extras_require 或 [project.optional-dependencies] 中声明所请求的额外项,因此 pip 仅安装基础包。

Workarounds

  1. 90% success
    pip install mypkg pytest ruff mypy
  2. 85% success
    # in pyproject.toml
    [project.optional-dependencies]
    dev = ["pytest", "ruff"]
    pip install -e '.[dev]'

Dead Ends

Common approaches that don't work:

  1. 90% fail

    --pre enables pre-releases but does not create extras that are not declared.

  2. 85% fail

    Upgrading does not add extras to the metadata; the warning persists.

  3. 70% fail

    If 'all' is not declared either, the same warning appears for 'all'.