python install_error ai_generated true

错误:异常: 回溯(最近一次调用最后): 文件 "/tmp/pip-build-env-.../overlay/lib/python3.11/site-packages/setuptools/build_meta.py",第 317 行,在 get_requires_for_build_wheel 中 return self._get_build_requires(config_settings, requirements=[]) ... ModuleNotFoundError:没有名为 'setuptools' 的模块

ERROR: Exception: Traceback (most recent call last): File "/tmp/pip-build-env-.../overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 317, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) ... ModuleNotFoundError: No module named 'setuptools'

ID: python/pip-metadata-generation-failed

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

版本兼容性

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

根因分析

启用了构建隔离,但隔离的构建环境中未安装 setuptools,通常由于 pip 损坏或缺少构建后端。

English

Build isolation is enabled but setuptools is not installed in the isolated build environment, often due to a broken pip or missing build backend.

generic

解决方案

  1. 90% 成功率
    Install setuptools and wheel in the main env, then use `--no-build-isolation`: `pip install setuptools wheel && pip install --no-build-isolation foo`.
  2. 75% 成功率
    Upgrade pip to latest: `python -m pip install --upgrade pip`.

无效尝试

常见但无效的做法:

  1. 80% 失败

    Build isolation uses a separate environment; installing globally does not help.

  2. 50% 失败

    May still fail if setuptools is not installed in the main environment.