{"record":{"id":"c810d07c4b273229","repo":"open-mmlab/mmdetection","slug":"please-run-pip-install-instaboostfast-to-install-c810d0","errorCode":null,"errorMessage":"Please run \"pip install instaboostfast\" to install instaboostfast first.","messagePattern":"Please run \"pip install instaboostfast\" to install instaboostfast first\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"mmdet/datasets/transforms/instaboost.py","lineNumber":138,"sourceCode":"\n        instances.extend(ignore_anns)\n        results['img'] = img\n        results['instances'] = instances\n        return results\n\n    def transform(self, results) -> dict:\n        \"\"\"The transform function.\"\"\"\n        img = results['img']\n        ori_type = img.dtype\n        if 'instances' not in results or len(results['instances']) == 0:\n            return results\n\n        anns, ignore_anns = self._load_anns(results)\n        if np.random.choice([0, 1], p=[1 - self.aug_ratio, self.aug_ratio]):\n            try:\n                import instaboostfast as instaboost\n            except ImportError:\n                raise ImportError('Please run \"pip install instaboostfast\" '\n                                  'to install instaboostfast first.')\n            anns, img = instaboost.get_new_data(\n                anns, img.astype(np.uint8), self.cfg, background=None)\n\n        results = self._parse_anns(results, anns, ignore_anns,\n                                   img.astype(ori_type))\n        return results\n\n    def __repr__(self) -> str:\n        repr_str = self.__class__.__name__\n        repr_str += f'(aug_ratio={self.aug_ratio})'\n        return repr_str\n","sourceCodeStart":120,"sourceCodeEnd":151,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/datasets/transforms/instaboost.py#L120-L151","documentation":"The transform() method of InstaBoost lazily re-imports instaboostfast at augmentation time (when the random aug_ratio check passes). If the package was uninstalled or became unimportable after init (e.g. broken env), the ImportError surfaces mid-training instead of at pipeline construction.","triggerScenarios":"Calling InstaBoost.transform() where np.random.choice selects augmentation (aug_ratio > 0) and `import instaboostfast` fails at runtime, typically because the environment changed between __init__ and training, or the object was constructed with the import succeeding but later runs in a different process/env.","commonSituations":"Training resumed from a pickle/copy of the pipeline in a worker process without the package; environment switched via SLURM/worker launch; partial installs where the .so import fails intermittently.","solutions":["pip install instaboostfast and restart training so all dataloader workers import it cleanly","Verify the import in the same interpreter used for training: python -c \"import instaboostfast\"","Disable or set aug_prob/aug_ratio to 0 in the InstaBoost config entry to skip the code path"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import importlib.util\nassert importlib.util.find_spec('instaboostfast') is not None, 'instaboostfast missing in worker env'","typeGuard":null,"tryCatchPattern":"try:\n    out = instaboost_tf.transform(results)\nexcept ImportError as e:\n    # fall back to unaugmented results\n    logger.warning(f'skipping instaboost: {e}')\n    return results","preventionTips":["Smoke-test the full train pipeline once (pipeline([dummy_sample])) before launching long jobs","Ensure dataloader workers inherit the same environment as the main process"],"tags":["mmdetection","instaboost","lazy-import","runtime-importerror","augmentation"],"backgroundTag":"missing-optional-dependency","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}