pip build_error ai_generated partial

ERROR: Project has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Cannot build editable. The project's build backend 'setuptools.build_meta' does not have a 'build_editable' hook.

ID: pip/pyproject-toml-build-backend-missing

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 24.1 active
setuptools 68.0 active
Python 3.11 active

Root Cause

The pyproject.toml specifies a build backend (e.g., setuptools.build_meta) that does not support the 'build_editable' hook, required for 'pip install -e .' with modern pip.

generic

中文

pyproject.toml 指定了一个构建后端(例如 setuptools.build_meta),该后端不支持 'build_editable' 钩子,而现代 pip 的 'pip install -e .' 需要此钩子。

Official Documentation

https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#editable-install

Workarounds

  1. 85% success Upgrade setuptools to version 64+ which supports build_editable: 'pip install --upgrade setuptools>=64' then retry editable install.
    Upgrade setuptools to version 64+ which supports build_editable: 'pip install --upgrade setuptools>=64' then retry editable install.
  2. 95% success Temporarily install without editable mode: 'pip install .' instead of 'pip install -e .'
    Temporarily install without editable mode: 'pip install .' instead of 'pip install -e .'
  3. 75% success Add a custom build backend in pyproject.toml that supports editable installs, e.g., use 'hatchling' or 'flit_core': [build-system] requires = ["hatchling"] build-backend = "hatchling.build"
    Add a custom build backend in pyproject.toml that supports editable installs, e.g., use 'hatchling' or 'flit_core':
    [build-system]
    requires = ["hatchling"]
    build-backend = "hatchling.build"

中文步骤

  1. 升级 setuptools 到 64+ 版本,该版本支持 build_editable:'pip install --upgrade setuptools>=64' 然后重试可编辑安装。
  2. 临时使用非可编辑模式安装:'pip install .' 而不是 'pip install -e .'
  3. 在 pyproject.toml 中添加支持可编辑安装的自定义构建后端,例如使用 'hatchling' 或 'flit_core':
    [build-system]
    requires = ["hatchling"]
    build-backend = "hatchling.build"

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Upgrading pip does not add the hook; the build backend must support it.

  2. 70% fail

    Deleting pyproject.toml and using setup.py directly may work but breaks build system standardization and can cause other issues.

  3. 95% fail

    Using 'pip install --no-build-isolation' does not bypass the hook requirement; it still fails.