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
- Install build dependencies (compiler + headers) for your OS.
- Upgrade pip/build tooling and retry with
--no-cache-dir -v. - 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.
- 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
- Re-run the install and confirm a wheel is built (or downloaded) and installed successfully.
- Confirm import/runtime works:
python -c 'import <module>'.
Manual wheel-build checks
- Re-run with
-vand capture logs. Identify the first toolchain/library error. - Confirm your OS has a compiler toolchain installed and Python development headers available.
- 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
- For PEP 517/518 projects, pip builds a wheel using the project's declared build backend.
- If the wheel build fails, pip cannot proceed with installation because it doesn't fall back to legacy
setup.py installfor those projects. - 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,
)