{"record":{"id":"6e5fbecb248dc003","repo":"open-mmlab/mmdetection","slug":"albumentations-is-not-installed","errorCode":null,"errorMessage":"albumentations is not installed","messagePattern":"albumentations is not installed","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"mmdet/datasets/transforms/transforms.py","lineNumber":1608,"sourceCode":"                p=0.1),\n        ]\n\n    Args:\n        transforms (list[dict]): A list of albu transformations\n        bbox_params (dict, optional): Bbox_params for albumentation `Compose`\n        keymap (dict, optional): Contains\n            {'input key':'albumentation-style key'}\n        skip_img_without_anno (bool): Whether to skip the image if no ann left\n            after aug. Defaults to False.\n    \"\"\"\n\n    def __init__(self,\n                 transforms: List[dict],\n                 bbox_params: Optional[dict] = None,\n                 keymap: Optional[dict] = None,\n                 skip_img_without_anno: bool = False) -> None:\n        if Compose is None:\n            raise RuntimeError('albumentations is not installed')\n\n        # Args will be modified later, copying it will be safer\n        transforms = copy.deepcopy(transforms)\n        if bbox_params is not None:\n            bbox_params = copy.deepcopy(bbox_params)\n        if keymap is not None:\n            keymap = copy.deepcopy(keymap)\n        self.transforms = transforms\n        self.filter_lost_elements = False\n        self.skip_img_without_anno = skip_img_without_anno\n\n        # A simple workaround to remove masks without boxes\n        if (isinstance(bbox_params, dict) and 'label_fields' in bbox_params\n                and 'filter_lost_elements' in bbox_params):\n            self.filter_lost_elements = True\n            self.origin_label_fields = bbox_params['label_fields']\n            bbox_params['label_fields'] = ['idx_mapper']\n            del bbox_params['filter_lost_elements']","sourceCodeStart":1590,"sourceCodeEnd":1626,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/datasets/transforms/transforms.py#L1590-L1626","documentation":"Albu (albumentations wrapper) transform in mmdet lazily imports albumentations; if it is absent, Compose is None and __init__ raises RuntimeError. The wrapper cannot build any augmentation pipeline without the library.","triggerScenarios":"Config contains dict(type='Albu', transforms=[...]) while the albumentations package is not installed in the environment.","commonSituations":"Copying a training config that uses Albu (e.g. some YOLOX or custom pipelines) into an environment without the extra; albumentations is an optional extra of mmdet.","solutions":["pip install albumentations","Confirm version compatibility (mmdet >=0.5 behavior differs): pip install albumentations>=0.5","Drop the Albu transform from the pipeline if not needed"],"exampleFix":"# before\ndict(type='Albu', transforms=[dict(type='RandomBrightnessContrast', p=0.5)])\n# after: install first\n# pip install albumentations>=1.0\n# then keep the same config","handlingStrategy":"validation","validationCode":"from mmdet.datasets.transforms import Albu\nfrom mmdet.datasets.transforms.transforms import Compose\nassert Compose is not None, 'albumentations not installed'","typeGuard":null,"tryCatchPattern":"try:\n    Albu(transforms=[dict(type='HorizontalFlip', p=0.5)])\nexcept RuntimeError as e:\n    if 'albumentations' in str(e):\n        subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'albumentations'])","preventionTips":["Keep requirements files pinned with optional extras used by your configs","Add a startup dependency check in training scripts"],"tags":["mmdet","albumentations","dependency","augmentation"],"backgroundTag":"missing-optional-dependency","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}