python install_error ai_generated true

ERROR: Could not build wheels for <package>, which is required to install pyproject.toml-based projects

ID: python/pip-could-not-build-wheels-required-to-install-pyproject

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2024-04-17First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

Root Cause

The package uses PEP 517 and pip must build a wheel, but the wheel build fails — typically due to missing C toolchain, missing headers (e.g., libssl-dev), or a compiler error in the C extension.

generic

中文

包使用 PEP 517,pip 必须构建 wheel,但 wheel 构建失败——通常由于缺少 C 工具链、缺少头文件(如 libssl-dev),或 C 扩展中的编译器错误。

Workarounds

  1. 80% success
    # Debian/Ubuntu
    sudo apt-get install -y build-essential python3-dev libssl-dev libffi-dev
    # macOS
    brew install openssl@3
    pip install <package>
  2. 75% success
    pip install --only-binary=:all: <package>
    # fallback: download from https://pypi.org/project/<package>/#files

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Cache is not the issue; the compile step fails every time.

  2. 80% fail

    Pre-releases rarely ship wheels for every platform; the compile still fails.