python install_error ai_generated true

错误:无法为 mypackage 构建 wheel,这是安装基于 pyproject.toml 的项目所必需的 错误:无效命令 'bdist_wheel' 错误:为 mypackage 构建 wheel 失败

ERROR: Could not build wheels for mypackage, which is required to install pyproject.toml-based projects error: invalid command 'bdist_wheel' ERROR: Failed building wheel for mypackage

ID: python/setuptools-build-backend-missing

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

版本兼容性

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

根因分析

项目的 pyproject.toml 中的 build-system.requires 未包含 'wheel',而旧版构建后端(setuptools.build_meta:__legacy__)在没有它的情况下无法构建 wheel。

English

The project's build-system.requires in pyproject.toml does not include 'wheel', and the legacy build backend (setuptools.build_meta:__legacy__) cannot build a wheel without it.

generic

解决方案

  1. 98% 成功率
    [build-system]\nrequires = ["setuptools>=61", "wheel"]\nbuild-backend = "setuptools.build_meta"
  2. 90% 成功率
    pip install --upgrade setuptools wheel && pip install mypackage

无效尝试

常见但无效的做法:

  1. 85% 失败

    Forces source build, which still needs wheel to produce the artifact for installation.

  2. 60% 失败

    Uses the ambient environment's setuptools, which may also lack wheel.