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

其他格式: JSON · Markdown 中文 · English
80%修复率
86%置信度
0证据数
2024-05-02首次发现

版本兼容性

版本状态引入弃用备注
3.9 active
3.10 active
3.11 active
3.12 active

根因分析

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

English

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

解决方案

  1. 85% 成功率
    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% 成功率
    Install the build backend's runtime deps manually, or use legacy build: `pip install --no-build-isolation <pkg>` after `pip install setuptools wheel`.

无效尝试

常见但无效的做法:

  1. 90% 失败

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

  2. 70% 失败

    The same source distribution is fetched and fails identically.