pypa/pip · error · InstallationError

Some build dependencies for {requirement} are missing: {miss

Error message

Some build dependencies for {requirement} are missing: {missing}.

What it means

InstallationError raised by SourceDistribution._raise_missing_reqs when check_requirements finds that build dependencies declared by the project are entirely absent from the build environment. Unlike conflicts (present-but-wrong), here the packages are not installed at all, so the build cannot proceed.

Source

Thrown at src/pip/_internal/distributions/sdist.py:189

        )
        error_message = format_string.format(
            requirement=self.req,
            conflicting_with=conflicting_with,
            description=", ".join(
                f"{installed} is incompatible with {wanted}"
                for installed, wanted in sorted(conflicting_reqs)
            ),
        )
        raise InstallationError(error_message)

    def _raise_missing_reqs(self, missing: set[str]) -> None:
        format_string = (
            "Some build dependencies for {requirement} are missing: {missing}."
        )
        error_message = format_string.format(
            requirement=self.req, missing=", ".join(map(repr, sorted(missing)))
        )
        raise InstallationError(error_message)

View on GitHub (pinned to d7d0d0a394)

Solutions

  1. Install each listed missing requirement into the active environment: pip install <each missing name>.
  2. Drop --no-build-isolation so pip provisions the declared [build-system].requires in an isolated venv.
  3. Ensure pyproject.toml [build-system].requires is correct and not referencing a package you don't actually need.
  4. In CI, pre-install the build toolchain (setuptools wheel packaging) in the base image.

Example fix

# before
pip install --no-build-isolation .
# error: missing setuptools>=64, wheel

# after
pip install "setuptools>=64" wheel
pip install --no-build-isolation .
# or simply
pip install .
Defensive patterns

Strategy: validation

Validate before calling

import tomllib, importlib
with open('pyproject.toml','rb') as f: data=tomllib.load(f)
missing = [r for r in data.get('build-system',{}).get('requires',[])
           if importlib.util.find_spec(r.split('[',1)[0].replace('-','_')) is None]
if missing:
    print('install first:', missing)

Type guard

def has_build_deps(requires: list[str]) -> bool:
    import importlib.util
    for r in requires:
        name = r.split('[',1)[0].split('>')[0].split('<')[0].replace('-','_').strip()
        if importlib.util.find_spec(name) is None:
            return False
    return True

Try / catch

from pip._internal.exceptions import InstallationError
try:
    dist.prepare_distribution_metadata(env_installer, isolation, True, True)
except InstallationError as e:
    if 'are missing' in str(e):
        missing = parse_missing(e)  # extract names
        subprocess.check_call([sys.executable,'-m','pip','install',*missing])

Prevention

When it happens

Trigger: Raised after prepare_distribution_metadata calls check_build_deps (when --check-build-deps / default behavior) and self.req.build_env.check_requirements(pyproject_requires) returns a non-empty missing set. Common with --no-build-isolation when the host interpreter lacks setuptools/wheel/cython/etc. that [build-system].requires lists.

Common situations: Building an sdist with --no-build-isolation in a slim container/CI image missing build tools; a pyproject.toml that adds a build dep (e.g. flit-core, poetry-core) the environment doesn't have; --target/--prefix installs into an environment without the build backend.

Related errors


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