# 错误：异常：
回溯（最近一次调用最后）：
  文件 "/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' 的模块

- **ID:** `python/pip-metadata-generation-failed`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

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`.
   ```

## 无效尝试

- **** — Build isolation uses a separate environment; installing globally does not help. (80% 失败率)
- **** — May still fail if setuptools is not installed in the main environment. (50% 失败率)
