AlexsJones/llmfit · error · ValueError

LLMFIT_PYTHON_PLATFORM_TAG is not supported for editable…

Error message

LLMFIT_PYTHON_PLATFORM_TAG is not supported for editable installs. Let the build system detect the host platform instead.

What it means

Raised in LlmfitBinaryBuildHook.initialize() when Hatchling requests an editable build (version == 'editable') while the LLMFIT_PYTHON_PLATFORM_TAG environment variable is set. Editable installs always use the locally compiled host binary from target/debug or target/release, so a wheel-platform override is meaningless there and is rejected with this ValueError.

Solutions

  1. Unset the variable for editable work: `unset LLMFIT_PYTHON_PLATFORM_TAG && uv sync` (or `env -u LLMFIT_PYTHON_PLATFORM_TAG uv sync`)
  2. Scope the variable to the single release command instead of the shell: `LLMFIT_PYTHON_PLATFORM_TAG=manylinux_2_17_aarch64 uv build`
  3. In CI, split cross-build (standard) and dev-install (editable) steps so the variable only exists in the release step

Example fix

# before
export LLMFIT_PYTHON_PLATFORM_TAG=manylinux_2_17_aarch64
uv sync  # ValueError: not supported for editable installs

# after
unset LLMFIT_PYTHON_PLATFORM_TAG
uv sync
Defensive patterns

Strategy: validation

Validate before calling

import os
if os.environ.get("UV editable marker", ""):  # placeholder
    pass
# practical guard before an editable install:
if os.environ.get("LLMFIT_PYTHON_PLATFORM_TAG"):
    import subprocess, sys
    cmd = sys.argv[1:]
    if any(a in ("sync", "run") or "-e" in a for a in cmd):
        del os.environ["LLMFIT_PYTHON_PLATFORM_TAG"]

Try / catch

try:
    subprocess.run(["uv", "sync"], check=True)
except subprocess.CalledProcessError:
    raise SystemExit("editable install failed — check LLMFIT_PYTHON_PLATFORM_TAG is not set")

Prevention

When it happens

Trigger: Exporting LLMFIT_PYTHON_PLATFORM_TAG for a release/cross build (e.g. in a CI matrix or shell profile) and then running `uv sync`, `uv run`, or `pip install -e llmfit-python` in the same shell without clearing the variable.

Common situations: A CI job template that sets the tag globally for all steps, including the editable-install smoke test; a developer's .zshrc/.bashrc exporting the variable after doing one cross build; switching between `uv build` and `uv sync` in one script.

Related errors


AI-assisted analysis of AlexsJones/llmfit@acc7e40c3a (2026-08-17). Data as JSON: /api/errors/5e0e52aa7a981b71. Report an issue: GitHub.

Appendix: source

Thrown at llmfit-python/hatch_build.py:169

        )
        output = result.stdout.strip()  # e.g. "llmfit 0.9.8"
        match = re.match(r"^llmfit v?(\d+\.\d+\.\d+)$", output)
        if not match:
            raise RuntimeError(f"Unexpected output from '{bin_path} --version': {output!r}")
        binary_version = match.group(1)
        if binary_version != expected_version:
            raise RuntimeError(
                f"Binary version mismatch: binary at {bin_path} reports {binary_version!r} "
                f"but Cargo.toml (or LLMFIT_VERSION) says {expected_version!r}. "
                "Run 'make build' to recompile.",
            )
        print(f"  Binary version OK ({binary_version})")

    def initialize(self, version: str, build_data: dict) -> None:
        """Locate the platform binary and configure the wheel before it is built."""
        py_target_from_env = os.environ.get("LLMFIT_PYTHON_PLATFORM_TAG")
        if version == "editable" and py_target_from_env:
            raise ValueError(
                "LLMFIT_PYTHON_PLATFORM_TAG is not supported for editable installs. "
                "Let the build system detect the host platform instead.",
            )
        running_platform = self._detect_platform()
        py_target = py_target_from_env or running_platform
        if py_target not in TARGET_CONFIGS:
            raise ValueError(
                f"Unknown LLMFIT_PYTHON_PLATFORM_TAG={py_target!r}. Must be one of: {sorted(TARGET_CONFIGS)}",
            )

        upstream_target, binary_name = TARGET_CONFIGS[py_target]
        pypi_version: str = self.metadata.version

        print(f"  target={upstream_target}  version={pypi_version}  wheel tag=py3-none-{py_target}")

        llmfit_root = Path(self.root).parent
        if version == "editable":
            # For editable installs, look for target/debug/llmfit or target/release/llmfit (or llmfit.exe on Windows).

View on GitHub (pinned to acc7e40c3a)