python
install_error
ai_generated
true
错误:无法为 mypkg 构建 wheel,而这是安装基于 pyproject.toml 的项目所必需的 × 为 mypkg 构建 wheel(pyproject.toml)未能成功运行。 │ 退出代码:1 ╰─> ModuleNotFoundError: 没有名为 'setuptools' 的模块
ERROR: Could not build wheels for mypkg, which is required to install pyproject.toml-based projects × Building wheel for mypkg (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> ModuleNotFoundError: No module named 'setuptools'
ID: python/setuptools-missing-build-system-requires
80%修复率
88%置信度
0证据数
2024-03-28首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
项目的 pyproject.toml 声明了 [build-system] 表,但其 'requires' 中缺少 setuptools(或声明为空列表),因此隔离的构建环境缺少该后端。
English
The project's pyproject.toml declares a [build-system] table whose 'requires' omits setuptools (or declares an empty list), so the isolated build env lacks the backend.
解决方案
-
97% 成功率
[build-system] requires = ["setuptools>=68", "wheel"] build-backend = "setuptools.build_meta"
-
90% 成功率
python -m pip install 'setuptools>=68' wheel python -m pip install --no-build-isolation mypkg
无效尝试
常见但无效的做法:
-
85% 失败
Build isolation creates a fresh env; the current venv's setuptools is not visible.
-
75% 失败
Then the build uses the current Python's setuptools, which may be absent or too old.