python install_error ai_generated true

error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output.

ID: python/metadata-generation-failed-setuptools

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.9 active
3.10 active
3.11 active
3.12 active

Root Cause

pip's PEP 517 isolated build could not generate metadata because the package's setup.py/build backend raised an exception (commonly a missing dependency, a syntax error in setup.py, or an unimportable package).

generic

中文

pip 的 PEP 517 隔离构建无法生成元数据,因为包的 setup.py/构建后端抛出了异常(常见原因:缺少依赖、setup.py 语法错误或包无法导入)。

Workarounds

  1. 85% success
    Re-run with verbose output to see the real exception: `pip install -v <pkg>`. The actual error (e.g. `ModuleNotFoundError` inside setup.py) appears a few lines above.
  2. 70% success
    Install the build backend's runtime deps manually, or use legacy build: `pip install --no-build-isolation <pkg>` after `pip install setuptools wheel`.

Dead Ends

Common approaches that don't work:

  1. 90% fail

    The failure happens during metadata generation, not from a corrupted cache.

  2. 70% fail

    The same source distribution is fetched and fails identically.