ERROR pip build_error ai_generated true

ERROR: Could not find a backend for building the project. The project uses a build backend that is not installed. The build backend is '<backend_name>'.

ID: pip/pep-517-backend-not-found-during-build

Also available as: JSON · Markdown · 中文
82%Fix Rate
87%Confidence
1Evidence
2023-05-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 21.3 active
pip 23.1 active
pip 24.0 active

Root Cause

The pyproject.toml specifies a build backend (e.g., `setuptools.build_meta`, `flit_core.buildapi`, `maturin`) that is not installed in the current environment, causing pip to fail when trying to build the package.

generic

中文

pyproject.toml 指定了一个构建后端(例如 `setuptools.build_meta`、`flit_core.buildapi`、`maturin`),但该后端未在当前环境中安装,导致 pip 在尝试构建包时失败。

Official Documentation

https://packaging.python.org/en/latest/tutorials/packaging-projects/#configuring-metadata

Workarounds

  1. 85% success Install the missing build backend explicitly: `pip install <backend_name>` (e.g., `pip install setuptools` or `pip install flit_core`), then retry the original install.
    Install the missing build backend explicitly: `pip install <backend_name>` (e.g., `pip install setuptools` or `pip install flit_core`), then retry the original install.
  2. 70% success Use `pip install <package> --no-build-isolation --no-deps` and manually provide the backend via environment variable: `PIP_REQUIRE_VIRTUALENV=false pip install <package> --no-build-isolation`
    Use `pip install <package> --no-build-isolation --no-deps` and manually provide the backend via environment variable: `PIP_REQUIRE_VIRTUALENV=false pip install <package> --no-build-isolation`

中文步骤

  1. 显式安装缺失的构建后端:`pip install <backend_name>`(例如 `pip install setuptools` 或 `pip install flit_core`),然后重试原始安装。
  2. 使用 `pip install <package> --no-build-isolation --no-deps` 并通过环境变量手动提供后端:`PIP_REQUIRE_VIRTUALENV=false pip install <package> --no-build-isolation`

Dead Ends

Common approaches that don't work:

  1. 90% fail

    This flag disables build isolation but does not install the missing backend; pip will still fail if the backend is not available in the environment.

  2. 95% fail

    The `--no-deps` flag only affects runtime dependencies, not build dependencies; the build backend is a build dependency and is still required.