ERROR pip install_error ai_generated true

ERROR: Could not find a version that satisfies the requirement <package> (from versions: none). No matching distribution found (no binary available for this platform)

ID: pip/no-binary-available-for-platform

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
1Evidence
2024-01-12First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 22.0+ active
Python 3.11 active
aarch64 active

Root Cause

The requested package has no pre-built wheel for the user's platform (e.g., aarch64, 32-bit, or unsupported OS), and pip cannot build from source due to missing build dependencies or platform incompatibility.

generic

中文

请求的包没有针对用户平台(例如 aarch64、32 位或不支持的操作系统)的预构建 wheel,并且由于缺少构建依赖项或平台不兼容,pip 无法从源代码构建。

Official Documentation

https://pip.pypa.io/en/stable/topics/platform-compatibility/

Workarounds

  1. 75% success Enable pip to build from source by installing build dependencies: pip install <package> --no-binary :all:
    Enable pip to build from source by installing build dependencies: pip install <package> --no-binary :all:
  2. 85% success Use a third-party repository that provides wheels for your platform (e.g., conda-forge for aarch64): conda install -c conda-forge <package>
    Use a third-party repository that provides wheels for your platform (e.g., conda-forge for aarch64): conda install -c conda-forge <package>
  3. 80% success Cross-compile the wheel on a compatible machine and transfer it: pip wheel <package> --wheel-dir=./wheels/ && pip install --no-index --find-links=./wheels/ <package>
    Cross-compile the wheel on a compatible machine and transfer it: pip wheel <package> --wheel-dir=./wheels/ && pip install --no-index --find-links=./wheels/ <package>

中文步骤

  1. 通过安装构建依赖项允许 pip 从源代码构建:pip install <package> --no-binary :all:
  2. 使用为你的平台提供 wheel 的第三方仓库(例如 conda-forge 用于 aarch64):conda install -c conda-forge <package>
  3. 在兼容的机器上交叉编译 wheel 并传输:pip wheel <package> --wheel-dir=./wheels/ && pip install --no-index --find-links=./wheels/ <package>

Dead Ends

Common approaches that don't work:

  1. Using --only-binary=:all: flag 100% fail

    This flag forces pip to only use binary wheels, but if none exist for the platform, it will fail immediately with the same error.

  2. Installing with --no-index and pointing to a local directory with wrong wheels 90% fail

    Providing wheels built for a different architecture (e.g., x86_64 on arm64) will cause incompatible binary errors or segfaults at runtime.

  3. Downgrading pip to an older version 20% fail

    Older pip versions have the same or worse platform detection; the issue is with the package availability, not pip version.