open-mmlab/mmdetection · error · ImportError
Please run "pip install instaboostfast" to install instaboos
Error message
Please run "pip install instaboostfast" to install instaboostfast first.
What it means
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.
Source
Thrown at mmdet/datasets/transforms/instaboost.py:138
instances.extend(ignore_anns)
results['img'] = img
results['instances'] = instances
return results
def transform(self, results) -> dict:
"""The transform function."""
img = results['img']
ori_type = img.dtype
if 'instances' not in results or len(results['instances']) == 0:
return results
anns, ignore_anns = self._load_anns(results)
if np.random.choice([0, 1], p=[1 - self.aug_ratio, self.aug_ratio]):
try:
import instaboostfast as instaboost
except ImportError:
raise ImportError('Please run "pip install instaboostfast" '
'to install instaboostfast first.')
anns, img = instaboost.get_new_data(
anns, img.astype(np.uint8), self.cfg, background=None)
results = self._parse_anns(results, anns, ignore_anns,
img.astype(ori_type))
return results
def __repr__(self) -> str:
repr_str = self.__class__.__name__
repr_str += f'(aug_ratio={self.aug_ratio})'
return repr_str
View on GitHub (pinned to cfd5d3a985)
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
Defensive patterns
Strategy: try-catch
Validate before calling
import importlib.util
assert importlib.util.find_spec('instaboostfast') is not None, 'instaboostfast missing in worker env' Try / catch
try:
out = instaboost_tf.transform(results)
except ImportError as e:
# fall back to unaugmented results
logger.warning(f'skipping instaboost: {e}')
return results Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Please run "pip install instaboostfast" to install instaboos
- Invalid crop_type {crop_type}.
- LoadImageFromFile is not found in the test pipeline
- Visualization needs the "visualizer" termdefined in the conf
- Unsupported input type: {type(single_input)}
AI-assisted analysis of open-mmlab/mmdetection@cfd5d3a985 (2026-08-27).
Data as JSON: /api/errors/c810d07c4b273229.
Report an issue: GitHub.