python install_error ai_generated true

错误:子进程以错误退出 × python setup.py bdist_wheel 未能成功运行。 │ 退出代码:1 ╰─> [12 行输出] ModuleNotFoundError: 没有名为 'Cython' 的模块

error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [12 lines of output] ModuleNotFoundError: No module named 'Cython'

ID: python/pip-subprocess-exited-with-error-build-backend

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

版本兼容性

版本状态引入弃用备注
3.x active

根因分析

包的构建后端需要构建时依赖项(Cython、numpy 等),但这些依赖项未在 pyproject.toml 的 [build-system].requires 中声明,因此隔离的构建环境缺少它们。

English

The package's build backend requires build-time dependencies (Cython, numpy, etc.) that are not declared in pyproject.toml's [build-system].requires, so the isolated build environment lacks them.

generic

解决方案

  1. 85% 成功率
    python -m pip install Cython numpy
    python -m pip install --no-build-isolation mypkg
  2. 90% 成功率
    # If the project ships pyproject.toml with [build-system].requires
    python -m pip install build
    python -m build  # installs build-system.requires automatically

无效尝试

常见但无效的做法:

  1. 80% 失败

    PEP 517 build isolation uses a fresh env; packages in your venv are invisible to the build.

  2. 90% 失败

    The missing dependency is deterministic; retrying produces identical failure.