ERROR pip build_error ai_generated true

ERROR: Project has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Cannot build editable. The build backend does not support the 'build_editable' hook.

ID: pip/pep-660-editable-install-fails-no-build-backend

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
1Evidence
2023-06-12First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 21.3 active
pip 23.0 active
pip 23.2.1 active

Root Cause

The build backend specified in pyproject.toml (e.g., an older version of setuptools or a custom backend) does not implement the PEP 660 `build_editable` hook, which is required for editable installs using `pip install -e`.

generic

中文

pyproject.toml 中指定的构建后端(例如较旧版本的 setuptools 或自定义后端)未实现 PEP 660 的 `build_editable` 钩子,而该钩子是使用 `pip install -e` 进行可编辑安装所必需的。

Official Documentation

https://peps.python.org/pep-0660/

Workarounds

  1. 85% success Upgrade the build backend to a version that supports PEP 660. For setuptools: `pip install --upgrade setuptools>=64.0.0`. For flit: `pip install --upgrade flit_core>=3.8.0`. Then retry `pip install -e .`.
    Upgrade the build backend to a version that supports PEP 660. For setuptools: `pip install --upgrade setuptools>=64.0.0`. For flit: `pip install --upgrade flit_core>=3.8.0`. Then retry `pip install -e .`.
  2. 95% success Switch to a non-editable install temporarily: `pip install .` instead of `pip install -e .`. This bypasses the `build_editable` hook requirement.
    Switch to a non-editable install temporarily: `pip install .` instead of `pip install -e .`. This bypasses the `build_editable` hook requirement.

中文步骤

  1. 升级构建后端到支持 PEP 660 的版本。对于 setuptools:`pip install --upgrade setuptools>=64.0.0`。对于 flit:`pip install --upgrade flit_core>=3.8.0`。然后重试 `pip install -e .`。
  2. 临时切换到非可编辑安装:使用 `pip install .` 代替 `pip install -e .`。这将绕过 `build_editable` 钩子的要求。

Dead Ends

Common approaches that don't work:

  1. 90% fail

    The `--no-build-isolation` flag does not add the missing `build_editable` hook; it only prevents pip from creating a temporary build environment. The backend still lacks the hook.

  2. 85% fail

    This config setting is for setuptools specifically and only works if the backend already supports editable installs; it does not add the missing hook.