Error Knowledge Base PIP FAILED_TO_BUILD_WHEELS

ERROR: Failed to build installable wheels for some pyproject.toml based projects

pip attempted to build a wheel from a PEP 517 project, but the wheel build failed and pip cannot install it without a wheel.

Affected versions: All pip versions using PEP 517 builds.

What This Error Means

pip attempted to build a wheel from a PEP 517 project, but the wheel build failed and pip cannot install it without a wheel.

How to Fix It

  1. Install build dependencies (compiler + headers) for your OS.
  2. Upgrade pip/build tooling and retry with --no-cache-dir -v.
  3. If possible, install a version of the package that has a wheel for your platform, or use a Python version that the package supports with wheels.
  4. If the package requires Rust, install Rust (via rustup on most platforms) and retry.

Why It Happens

  • No compatible wheel exists, so pip must build from source.
  • Your environment lacks a required build toolchain (C/C++ compiler, Rust, etc.).
  • Your environment lacks required system libraries/headers used by the extension module.
  • The package's build scripts or backend are incompatible with your Python/platform.

How to Verify

  1. Re-run the install and confirm a wheel is built (or downloaded) and installed successfully.
  2. Confirm import/runtime works: python -c 'import <module>'.

Manual wheel-build checks

  1. Re-run with -v and capture logs. Identify the first toolchain/library error.
  2. Confirm your OS has a compiler toolchain installed and Python development headers available.
  3. Check whether a prebuilt wheel exists for your Python version, if not, consider using a supported Python version.

Common CLI Output

ERROR: Failed to build installable wheels for some pyproject.toml based projects (tiktoken)
ERROR: Could not build wheels for _ which use PEP 517 and cannot be installed directly

Why pip needs wheels for PEP 517 projects

  1. For PEP 517/518 projects, pip builds a wheel using the project's declared build backend.
  2. If the wheel build fails, pip cannot proceed with installation because it doesn't fall back to legacy setup.py install for those projects.
  3. The detailed failure is above the summary: compiler errors, missing toolchains (C/C++/Rust), or missing system libraries are the most common causes.

Prevention Tips

  • Use base images/CI runners with build toolchains preinstalled when you expect source builds.
  • Prefer wheels or internal wheel caches to avoid rebuilding from source repeatedly.
  • Stay on supported Python versions for your dependency stack.

Where This Can Be Triggered

github.com/pypa/pip/blob/25.3/src/pip/_internal/exceptions.py

pip raises this diagnostic when a PEP 517 wheel build fails, the real cause is in the earlier build output from the backend/toolchain. - GitHub

class InstallWheelBuildError(DiagnosticPipError):
    reference = "failed-wheel-build-for-install"

    def __init__(self, failed: list[InstallRequirement]) -> None:
        super().__init__(
            message=(
                "Failed to build installable wheels for some "
                "pyproject.toml based projects"
            ),
            context=", ".join(r.name for r in failed),  # type: ignore
            hint_stmt=None,
        )

Need help or found a mistake? Contact RepoFlow support for questions.

Join our mailing list