{"record":{"id":"532258048986b7a5","repo":"unslothai/unsloth","slug":"could-not-install-mamba-ssm-required-by-this-mamb","errorCode":null,"errorMessage":"Could not install mamba-ssm, required by this Mamba model.","messagePattern":"Could not install mamba-ssm, required by this Mamba model\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"studio/backend/utils/ssm_runtime.py","lineNumber":446,"sourceCode":"        package_version = CAUSAL_CONV1D_PACKAGE_VERSION,\n        release_tag = CAUSAL_CONV1D_RELEASE_TAG,\n        release_base_url = CAUSAL_CONV1D_RELEASE_BASE_URL,\n        status_cb = status_cb,\n        run = run,\n    ):\n        logger.warning(\"causal-conv1d unavailable; continuing on the model's torch fallback\")\n\n    if is_ssm and not _install_kernel(\n        import_name = \"mamba_ssm\",\n        display_name = \"mamba-ssm\",\n        pypi_name = \"mamba-ssm\",\n        package_version = MAMBA_SSM_PACKAGE_VERSION,\n        release_tag = MAMBA_SSM_RELEASE_TAG,\n        release_base_url = MAMBA_SSM_RELEASE_BASE_URL,\n        status_cb = status_cb,\n        run = run,\n    ):\n        raise RuntimeError(\"Could not install mamba-ssm, required by this Mamba model.\")\n","sourceCodeStart":428,"sourceCodeEnd":447,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/utils/ssm_runtime.py#L428-L447","documentation":"Raised by the SSM runtime bootstrap when a Mamba model is selected but _install_kernel() could not make the 'mamba_ssm' import available — the helper tried the configured install path (pinned PyPI version MAMBA_SSM_PACKAGE_VERSION or the release artifacts at MAMBA_SSM_RELEASE_BASE_URL/MAMBA_SSM_RELEASE_TAG) and it failed. Note causal-conv1d failure is tolerated (torch fallback), but mamba-ssm itself is mandatory, hence the hard RuntimeError.","triggerScenarios":"Loading a Mamba-architecture model when mamba_ssm is not installed and the bootstrap installer fails — unsupported torch/CUDA combination for the pinned wheels, offline machine with no cached artifacts, build-from-source failure (no compiler/CUDA toolkit), or a version mismatch between the pinned mamba-ssm release and the installed torch.","commonSituations":"New environment without mamba-ssm preinstalled; torch upgraded to a version with no matching prebuilt mamba-ssm wheel; air-gapped or proxy-restricted network blocking PyPI/GitHub release downloads; Windows where mamba-ssm builds routinely fail.","solutions":["Check the installer status output (status_cb messages) for the concrete sub-failure — wheel download error vs build failure.","Verify torch/CUDA versions and install a mamba-ssm build matching them (pip install mamba-ssm==<MAMBA_SSM_PACKAGE_VERSION> with the right --index-url for your CUDA).","On a restricted network, pre-download the wheel from the release tag at MAMBA_SSM_RELEASE_BASE_URL and install it manually, then restart so the import check passes.","If no compatible build exists for your stack, use a non-Mamba model or an environment where the pinned combination is known to work."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"def mamba_deps_ready() -> bool:\n    try:\n        import mamba_ssm  # noqa: F401\n        return True\n    except ImportError:\n        return False\n\nif model_arch == 'mamba' and not mamba_deps_ready():\n    warn_user('mamba-ssm will be installed on first Mamba load; ensure network + matching torch/CUDA')","typeGuard":null,"tryCatchPattern":"try:\n    load_model(model_id)  # Mamba model triggers kernel bootstrap\nexcept RuntimeError as e:\n    if 'Could not install mamba-ssm' in str(e):\n        surface_to_user('mamba-ssm install failed; check network/torch-CUDA pairing, '\n                        'or pip install mamba-ssm manually and retry')\n    else:\n        raise","preventionTips":["Pre-install mamba-ssm (matching your torch/CUDA build) before selecting Mamba models.","Run the first Mamba load once on a connected machine to warm the install cache for offline use.","Keep torch upgrades and the pinned mamba-ssm version in sync — verify wheel availability before upgrading torch."],"tags":["mamba","dependency-install","gpu","model-loading","python"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}