slint-ui/slint · warning

Could not load the slint-dev development binary: {error}

Error message

Could not load the slint-dev development binary: {error}

What it means

When dev mode is requested (SLINT_TEST_SERVER or SLINT_MCP_PORT set), the Python slint package imports the slint_dev_native extension from the version-matched slint-dev wheel to gain system-testing and MCP support. If that import raises ImportError (wheel present but its native binary will not load on this platform/interpreter), slint warns 'Could not load the slint-dev development binary: {error}' and falls back to the bundled lean release binary - so the dev features silently stay unavailable.

Source

Thrown at api/python/slint/slint/_native.py:61

        except importlib.metadata.PackageNotFoundError:
            dev_version = None

        if dev_version is not None:
            own_version = importlib.metadata.version("slint")
            if dev_version != own_version:
                warnings.warn(
                    f"Ignoring slint-dev {dev_version}: it does not match slint "
                    f"{own_version}. Install slint-dev=={own_version} to enable the "
                    "development binary with system-testing and MCP support.",
                    stacklevel=2,
                )
            else:
                try:
                    return importlib.import_module("slint_dev_native")
                except ImportError as error:
                    # Installed, but its native binary is unavailable on this
                    # platform. Fall back to the lean release binary.
                    warnings.warn(
                        f"Could not load the slint-dev development binary: {error}",
                        stacklevel=2,
                    )

    from . import slint as native

    return native


if TYPE_CHECKING:
    # Both binary variants expose the same surface, so type-check against the
    # bundled extension's stub (slint.pyi).
    from . import slint as native
else:
    native = _load_native()

View on GitHub (pinned to 3fd8f2ec03)

Solutions

  1. Surface the real cause first: run python -c "import slint_dev_native" and read the underlying ImportError (missing symbol, wrong ELF class, ...).
  2. Reinstall the matched pair from the same release: pip install --force-reinstall slint==X.Y.Z slint-dev==X.Y.Z.
  3. Move to a platform that has published slint-dev wheels (standard glibc Linux, standard macOS) if the platform is unsupported.
  4. If dev features are not actually needed in that run, unset SLINT_TEST_SERVER/SLINT_MCP_PORT so the lean release binary is used deliberately.

Example fix

# before: warning 'Could not load the slint-dev development binary: ...'
python -c "import slint_dev_native"   # shows the real ImportError

# after: same-version pair reinstalled on a supported platform
pip install --force-reinstall slint==1.X.Y slint-dev==1.X.Y
Defensive patterns

Strategy: fallback

Validate before calling

import importlib.util, importlib.metadata as md

def dev_binary_loadable() -> bool:
    if importlib.util.find_spec("slint_dev_native") is None:
        return False
    try:
        return md.version("slint-dev") == md.version("slint")
    except md.PackageNotFoundError:
        return False

# assert in test bootstrap so MCP/system-testing cannot silently go missing
assert dev_binary_loadable(), "install matching slint-dev for dev features"

Try / catch

try:
    import slint_dev_native  # noqa: F401
    dev_ok = True
except ImportError as e:
    dev_ok = False  # slint falls back to the lean release binary
    warnings.warn(f"dev binary unavailable: {e}")

Prevention

When it happens

Trigger: SLINT_TEST_SERVER/SLINT_MCP_PORT set, slint-dev installed at exactly the slint version, but importlib.import_module('slint_dev_native') raises ImportError: missing or incompatible .so (wrong glibc/musl, unsupported platform), Python ABI mismatch after an interpreter upgrade, or a partially installed package.

Common situations: Alpine/musl or older-glibc CI images with no matching manylinux wheel; upgrading Python without reinstalling slint-dev; macOS x86_64 vs arm64 wheel mismatch; pip installs with --no-binary or interrupted installs.

Related errors


AI-assisted analysis of slint-ui/slint@3fd8f2ec03 (2026-08-19). Data as JSON: /api/errors/5215e6f600afc271. Report an issue: GitHub.