python install_error ai_generated true

错误:子进程以错误退出 × python setup.py egg_info 未能成功运行。 │ 退出码:1 ╰─> [12 行输出] ModuleNotFoundError: No module named 'Cython' 注意:此错误源自子进程,很可能不是 pip 的问题。 错误:为 somepkg 构建 wheel 失败

error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [12 lines of output] ModuleNotFoundError: No module named 'Cython' note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for somepkg

ID: python/pip-subprocess-exited-with-error-metadata

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

版本兼容性

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

根因分析

源码分发包的构建步骤需要构建时依赖(Cython、numpy 头文件等),这些依赖未在 pyproject.toml [build-system].requires 中声明,且当前环境中也不存在。

English

A source distribution's build step requires build-time dependencies (Cython, numpy headers, etc.) that are not declared in pyproject.toml [build-system].requires and not present in the current environment.

generic

解决方案

  1. 90% 成功率
    pip install Cython numpy
    pip install somepkg
  2. 85% 成功率
    pip install --only-binary=:all: somepkg
    # or specify a wheel index
    pip install --index-url https://download.pytorch.org/whl/cpu somepkg

无效尝试

常见但无效的做法:

  1. 80% 失败

    The missing module is Cython, not pip/setuptools; upgrading build tools does not install Cython.

  2. 70% 失败

    Disabling build isolation uses the current env, which also lacks Cython, so the same ModuleNotFoundError occurs.