{"record":{"id":"84fd70cb62abeae1","repo":"blakeblackshear/frigate","slug":"rknn-lite-not-available","errorCode":null,"errorMessage":"RKNN Lite not available","messagePattern":"RKNN Lite not available","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"critical","filePath":"frigate/detectors/detection_runners.py","lineNumber":491,"sourceCode":"        \"\"\"Load the RKNN model.\"\"\"\n        try:\n            from rknnlite.api import RKNNLite\n\n            self.rknn = RKNNLite(verbose=False)\n\n            if self.rknn.load_rknn(self.model_path) != 0:\n                logger.error(f\"Failed to load RKNN model: {self.model_path}\")\n                raise RuntimeError(\"Failed to load RKNN model\")\n\n            if self.rknn.init_runtime(core_mask=self.core_mask) != 0:\n                logger.error(\"Failed to initialize RKNN runtime\")\n                raise RuntimeError(\"Failed to initialize RKNN runtime\")\n\n            logger.info(f\"Successfully loaded RKNN model: {self.model_path}\")\n\n        except ImportError:\n            logger.error(\"RKNN Lite not available\")\n            raise ImportError(\"RKNN Lite not available\") from None\n        except Exception as e:\n            logger.error(f\"Error loading RKNN model: {e}\")\n            raise\n\n    def get_input_names(self) -> list[str]:\n        \"\"\"Get input names for the model.\"\"\"\n        # For detection models, we typically use \"input\" as the default input name\n        # For CLIP models, we need to determine the model type from the path\n        model_name = os.path.basename(self.model_path).lower()\n\n        if \"vision\" in model_name:\n            return [\"pixel_values\"]\n        elif \"arcface\" in model_name:\n            return [\"data\"]\n        else:\n            # Default fallback - try to infer from model type\n            if self.model_type and \"jina-clip\" in self.model_type:\n                if \"vision\" in self.model_type:","sourceCodeStart":473,"sourceCodeEnd":509,"githubUrl":"https://github.com/blakeblackshear/frigate/blob/ca18b8dc131ccb3e086f13a780853b775ef13426/frigate/detectors/detection_runners.py#L473-L509","documentation":"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__.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use the Frigate Rockchip image/build (e.g. frigate:.*-rockchip tag) which bundles rknn-toolkit-lite2","If custom-installing, pip install rknn-toolkit-lite2 matching your board's python/arch and ensure librknnrt.so is on the system","Switch the detector to cpu or another available detector on non-Rockchip hardware"],"exampleFix":"# before\ndetectors:\n  rknn:\n    type: rknn\n# after (on non-Rockchip host)\ndetectors:\n  cpu:\n    type: cpu","handlingStrategy":"try-catch","validationCode":"def rknn_importable() -> bool:\n    try:\n        from rknn.toolkit.lite import RKNNRuntimeLite  # noqa: F401\n        return True\n    except ImportError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    detector = LocalDetector(detector_config)\nexcept ImportError as e:\n    if 'RKNN Lite not available' in str(e):\n        raise SystemExit('Use the Rockchip Frigate image or install rknn-toolkit-lite2') from None\n    raise","preventionTips":["Only configure the rknn detector on Rockchip deployments with the Rockchip image","Pre-check importability before selecting detector type in config","CI-test non-Rockchip images with cpu detector to catch accidental rknn defaults"],"tags":["rknn","import-error","module-not-found","rockchip","detector"],"backgroundTag":"optional-dependency-not-installed","analyzedSha":"ca18b8dc131ccb3e086f13a780853b775ef13426","analyzedAt":"2026-08-27T11:28:05.618Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}