AlexsJones/llmfit · error · RuntimeError

No suitable wheel platform found for runtime platform {first

Error message

No suitable wheel platform found for runtime platform {first!r}.

What it means

LlmfitBinaryBuildHook._detect_platform() walks packaging.tags.sys_tags() for the running interpreter and returns the first tag present in TARGET_CONFIGS (nine supported platforms: manylinux/musllinux x86_64+aarch64+riscv64, macOS x86_64+arm64, win_amd64+win_arm64). If none match, it raises RuntimeError naming the machine's best tag - the host has no wheel/binary configuration, so no llmfit wheel can be produced natively on it.

Source

Thrown at llmfit-python/hatch_build.py:101

        metadata["readme"] = {
            "content-type": "text/markdown",
            "text": readme.read_text(encoding="utf-8"),
        }


class LlmfitBinaryBuildHook(BuildHookInterface):
    """Hatchling build hook that injects the llmfit binary into each wheel."""

    PLUGIN_NAME = "llmfit binary"

    @staticmethod
    def _detect_platform() -> str:
        """Return the best platform tag for the current machine."""
        best = next((t.platform for t in sys_tags() if t.platform in TARGET_CONFIGS), None)
        if best is not None:
            return best
        first = next(t.platform for t in sys_tags())
        raise RuntimeError(f"No suitable wheel platform found for runtime platform {first!r}.")

    @staticmethod
    def _find_binary_for_target(llmfit_root: Path, py_target: str) -> Path:
        """Find the binary compiled for a specific Rust target.

        Looks in ``target/{upstream_target}/release/``, which is where Cargo
        places the binary when built with ``--target``.
        """
        upstream_target, binary_name = TARGET_CONFIGS[py_target]
        bin_path = llmfit_root / "target" / upstream_target / "release" / binary_name
        if not bin_path.is_file():
            raise FileNotFoundError(
                f"Binary not found at {bin_path}. Expected it to be built for target {upstream_target!r}.",
            )
        return bin_path

    @staticmethod
    def _find_local_binary(llmfit_root: Path) -> Path:

View on GitHub (pinned to a9ac7ed91c)

Solutions

  1. Build on one of the supported platforms instead: x86_64 or aarch64 Linux runners, macOS 11+ arm64 / macOS 10.12+ x86_64, or Windows amd64/arm64.
  2. Cross-build from a supported host: `LLMFIT_PYTHON_PLATFORM_TAG=<tag> cargo build --release --target <triple>` then `LLMFIT_PYTHON_PLATFORM_TAG=<tag> uv build`.
  3. If the platform genuinely must be supported, add an entry mapping it to a Rust triple in TARGET_CONFIGS in hatch_build.py:41 and teach CI to build that target.
  4. Print `python -c "from packaging.tags import sys_tags; print([t.platform for t in sys_tags()][:5])"` to confirm which tag your interpreter advertises.

Example fix

# before - building natively on an unsupported host
uv build  # RuntimeError: No suitable wheel platform found for runtime platform 'linux_ppc64le'.

# after - cross-build from a supported x86_64 host
cargo build --release --target powerpc64le-unknown-linux-gnu  # requires TARGET_CONFIGS entry
# or simply run the build on a supported runner (ubuntu-x86_64):
#   cargo build --release --target x86_64-unknown-linux-gnu && LLMFIT_PYTHON_PLATFORM_TAG=manylinux_2_17_x86_64 uv build
Defensive patterns

Strategy: validation

Validate before calling

from packaging.tags import sys_tags
SUPPORTED = {
    'manylinux_2_17_x86_64', 'manylinux_2_17_aarch64', 'manylinux_2_39_riscv64',
    'musllinux_1_2_x86_64', 'musllinux_1_2_aarch64',
    'macosx_10_12_x86_64', 'macosx_11_0_arm64', 'win_amd64', 'win_arm64',
}
host_tag = next((t.platform for t in sys_tags() if t.platform in SUPPORTED), None)
if host_tag is None:
    sys.exit(f'Unsupported host {next(t.platform for t in sys_tags())!r}; build on/cross from a supported platform')

Try / catch

try:
    hook_platform = detect_supported_platform()
except RuntimeError as e:
    if 'No suitable wheel platform' in str(e):
        switch_ci_runner_to_supported_arch()
    raise

Prevention

When it happens

Trigger: Building the wheel on an unsupported OS or CPU: FreeBSD (platform tag like freebsd_14_amd64), Linux ppc64le/s390x, 32-bit x86, or a Python whose sys_tags() yields a legacy tag such as linux_x86_64 before any manylinux tag; also a Python too old for the manylinux_2_17 tag priority on an odd distro.

Common situations: A CI matrix job scheduled on an unsupported architecture; attempting `pip install llmfit` from sdist on exotic hardware; running the build inside an unusual container (e.g. Alpine with a nonstandard musl tag ordering).

Related errors


AI-assisted analysis of AlexsJones/llmfit@a9ac7ed91c (2026-08-16). Data as JSON: /api/errors/4feac01f7c643476. Report an issue: GitHub.