blakeblackshear/frigate · critical · ImportError

RKNN Lite not available

Error message

RKNN Lite not available

What it means

The rknn module (RKNN Lite toolkit, rknn-toolkit-lite2) could not be imported, so the detector cannot run. This occurs only on Rockchip-based deployments where the RKNN detector plugin is selected; the ImportError is re-raised from _load_model during __init__.

Source

Thrown at frigate/detectors/detection_runners.py:491

        """Load the RKNN model."""
        try:
            from rknnlite.api import RKNNLite

            self.rknn = RKNNLite(verbose=False)

            if self.rknn.load_rknn(self.model_path) != 0:
                logger.error(f"Failed to load RKNN model: {self.model_path}")
                raise RuntimeError("Failed to load RKNN model")

            if self.rknn.init_runtime(core_mask=self.core_mask) != 0:
                logger.error("Failed to initialize RKNN runtime")
                raise RuntimeError("Failed to initialize RKNN runtime")

            logger.info(f"Successfully loaded RKNN model: {self.model_path}")

        except ImportError:
            logger.error("RKNN Lite not available")
            raise ImportError("RKNN Lite not available") from None
        except Exception as e:
            logger.error(f"Error loading RKNN model: {e}")
            raise

    def get_input_names(self) -> list[str]:
        """Get input names for the model."""
        # For detection models, we typically use "input" as the default input name
        # For CLIP models, we need to determine the model type from the path
        model_name = os.path.basename(self.model_path).lower()

        if "vision" in model_name:
            return ["pixel_values"]
        elif "arcface" in model_name:
            return ["data"]
        else:
            # Default fallback - try to infer from model type
            if self.model_type and "jina-clip" in self.model_type:
                if "vision" in self.model_type:

View on GitHub (pinned to ca18b8dc13)

Solutions

  1. Use the Frigate Rockchip image/build (e.g. frigate:.*-rockchip tag) which bundles rknn-toolkit-lite2
  2. If custom-installing, pip install rknn-toolkit-lite2 matching your board's python/arch and ensure librknnrt.so is on the system
  3. Switch the detector to cpu or another available detector on non-Rockchip hardware

Example fix

# before
detectors:
  rknn:
    type: rknn
# after (on non-Rockchip host)
detectors:
  cpu:
    type: cpu
Defensive patterns

Strategy: try-catch

Validate before calling

def rknn_importable() -> bool:
    try:
        from rknn.toolkit.lite import RKNNRuntimeLite  # noqa: F401
        return True
    except ImportError:
        return False

Try / catch

try:
    detector = LocalDetector(detector_config)
except ImportError as e:
    if 'RKNN Lite not available' in str(e):
        raise SystemExit('Use the Rockchip Frigate image or install rknn-toolkit-lite2') from None
    raise

Prevention

When it happens

Trigger: Selecting detector type rknn in Frigate config on a machine or container image where 'import rknn' (from rknn.toolkit.lite import RKNNRuntimeLite) raises ModuleNotFoundError. Typical on amd64/x86 test machines or a standard Frigate image instead of the Rockchip variant.

Common situations: Using the generic frigate docker image instead of the rockchip-specific build; testing an rknn config on a dev box without the toolkit; broken python environment where rknn-toolkit-lite2 was pip-installed for the wrong architecture.

Related errors


AI-assisted analysis of blakeblackshear/frigate@ca18b8dc13 (2026-08-27). Data as JSON: /api/errors/84fd70cb62abeae1. Report an issue: GitHub.