pypa/pip · error · HookMissing

build_editable

Error message

build_editable

What it means

During prepare_metadata_for_build_editable's fallback path, if the backend lacks prepare_metadata_for_build_editable AND also lacks build_editable, pyproject_hooks raises HookMissing(hook_name='build_editable'). The message is just the hook name 'build_editable', signaling the backend does not support editable installs.

Source

Thrown at src/pip/_vendor/pyproject_hooks/_in_process/_in_process.py:202

def prepare_metadata_for_build_editable(
    metadata_directory, config_settings, _allow_fallback
):
    """Invoke optional prepare_metadata_for_build_editable

    Implements a fallback by building an editable wheel if the hook isn't
    defined, unless _allow_fallback is False in which case HookMissing is
    raised.
    """
    backend = _build_backend()
    try:
        hook = backend.prepare_metadata_for_build_editable
    except AttributeError:
        if not _allow_fallback:
            raise HookMissing()
        try:
            build_hook = backend.build_editable
        except AttributeError:
            raise HookMissing(hook_name="build_editable")
        else:
            whl_basename = build_hook(metadata_directory, config_settings)
            return _get_wheel_metadata_from_wheel(
                whl_basename, metadata_directory, config_settings
            )
    else:
        return hook(metadata_directory, config_settings)


WHEEL_BUILT_MARKER = "PYPROJECT_HOOKS_ALREADY_BUILT_WHEEL"


def _dist_info_files(whl_zip):
    """Identify the .dist-info folder inside a wheel ZipFile."""
    res = []
    for path in whl_zip.namelist():
        m = re.match(r"[^/\\]+-[^/\\]+\.dist-info/", path)
        if m:

View on GitHub (pinned to d7d0d0a394)

Solutions

  1. Upgrade the build backend to a version that supports PEP 660 editable installs (e.g. setuptools>=64, hatchling, flit_core>=3.6).
  2. If editable install is optional, fall back to a regular install (pip install .) for that project.
  3. For a custom backend, implement build_editable (and optionally prepare_metadata_for_build_editable).

Example fix

# before
requires = ["setuptools==63"]
# running: pip install -e .

# after
requires = ["setuptools>=64"]
# editable install now supported
Defensive patterns

Strategy: validation

Validate before calling

features = hook._supported_features()
if 'build_editable' not in features:
    raise RuntimeError('backend does not support editable installs (PEP 660)')

Try / catch

from pip._vendor.pyproject_hooks._impl import HookMissing
try:
    hook.prepare_metadata_for_build_editable(md_dir)
except HookMissing as e:
    if e.hook_name == 'build_editable':
        log.warning('editable not supported; doing a regular install')

Prevention

When it happens

Trigger: A build backend that predates PEP 660 editable support is asked to produce editable metadata (e.g. pip install -e on a project whose backend defines neither prepare_metadata_for_build_editable nor build_editable).

Common situations: Using an older setuptools (<64) or a minimal custom backend with `pip install -e .`; tooling (pip, build) probing editable support via _supported_features and then attempting the editable hook.

Related errors


AI-assisted analysis of pypa/pip@d7d0d0a394 (2026-08-04). Data as JSON: /data/errors/244703032101a24e.json. Report an issue: GitHub.