# 错误：由于 BuildBackendException 无法安装软件包：后端 'setuptools.build_meta' 不可用。该项目需要以下构建依赖项：wheel, setuptools>=61.0。请检查这些依赖项是否已安装并在构建环境中可用。

- **ID:** `pip/pep-517-backend-requires-missing-dependency`
- **领域:** pip
- **类别:** build_error
- **错误码:** `ERROR`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pyproject.toml 中指定的构建系统（requires）列出的依赖项未安装在 pip 构建环境中，通常是因为使用了 --no-build-isolation 或构建环境缺少这些软件包。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 23.1 | active | — | — |
| pip 23.3 | active | — | — |
| pip 24.0 | active | — | — |
| setuptools 68.0 | active | — | — |

## 解决方案

1. ```
   确保构建隔离已启用（默认），pip 将自动在隔离环境中安装所需的构建依赖项。如果必须使用 --no-build-isolation，请预先安装确切的所需版本：pip install 'setuptools>=61.0' wheel
   ```
2. ```
   将 pip 升级到最新版本，以确保其正确处理 PEP 517/518 构建要求：pip install --upgrade pip
   ```
3. ```
   手动创建具有所需依赖项的构建环境，然后在激活该环境后使用 pip install --no-build-isolation ./package-dir 安装软件包。
   ```

## 无效尝试

- **Installing the missing build dependencies globally with pip install setuptools wheel** — If pip is using build isolation (default), it creates a temporary build environment that does not inherit global packages; the global install has no effect. (90% 失败率)
- **Adding --no-build-isolation without ensuring the build environment has the correct versions** — The global environment may have older versions of setuptools that do not satisfy the >=61.0 requirement. (70% 失败率)
- **Deleting pyproject.toml to force legacy setup.py install** — Modern packages may not have a setup.py, and pip will refuse to install without a build backend. (85% 失败率)
