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
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 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
-
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 .`.
-
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.
中文步骤
升级构建后端到支持 PEP 660 的版本。对于 setuptools:`pip install --upgrade setuptools>=64.0.0`。对于 flit:`pip install --upgrade flit_core>=3.8.0`。然后重试 `pip install -e .`。
临时切换到非可编辑安装:使用 `pip install .` 代替 `pip install -e .`。这将绕过 `build_editable` 钩子的要求。
Dead Ends
Common approaches that don't work:
-
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.
-
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.