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.

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

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 21.3+ active
Python 3.9-3.12 active

Root Cause

The pyproject.toml specifies a build backend (e.g., flit_core, poetry-core, mesonpy) that is not available in the build environment, often because it's not listed as a build-system.requires dependency.

generic

中文

pyproject.toml 指定了一个构建后端(例如 flit_core、poetry-core、mesonpy),但在构建环境中不可用,通常是因为它没有被列为 build-system.requires 依赖。

Official Documentation

https://pip.pypa.io/en/stable/topics/build-system/

Workarounds

  1. 90% success Add the missing backend to pyproject.toml under [build-system] requires: [build-system] requires = ["flit_core>=3.2"] build-backend = "flit_core.buildapi" Then re-run pip install.
    Add the missing backend to pyproject.toml under [build-system] requires:
    [build-system]
    requires = ["flit_core>=3.2"]
    build-backend = "flit_core.buildapi"
    Then re-run pip install.
  2. 75% success Install the package without build isolation: pip install --no-build-isolation <package>. Ensure the backend is pre-installed in the environment.
    Install the package without build isolation: pip install --no-build-isolation <package>. Ensure the backend is pre-installed in the environment.
  3. 70% success Upgrade pip to the latest version: python -m pip install --upgrade pip, which may improve backend detection.
    Upgrade pip to the latest version: python -m pip install --upgrade pip, which may improve backend detection.

中文步骤

  1. Add the missing backend to pyproject.toml under [build-system] requires:
    [build-system]
    requires = ["flit_core>=3.2"]
    build-backend = "flit_core.buildapi"
    Then re-run pip install.
  2. Install the package without build isolation: pip install --no-build-isolation <package>. Ensure the backend is pre-installed in the environment.
  3. Upgrade pip to the latest version: python -m pip install --upgrade pip, which may improve backend detection.

Dead Ends

Common approaches that don't work:

  1. 85% fail

    Pip's build isolation ignores the global environment; the backend must be declared in pyproject.toml's build-system.requires.

  2. 70% fail

    Modern packages may not include setup.py; removing pyproject.toml can break the build entirely.

  3. 60% fail

    This can cause version conflicts or missing dependencies, and is discouraged by pip maintainers.