{"id":5675,"library":"openmim","title":"MIM (OpenMMLab Install Manager)","description":"MIM is the official command-line utility for managing OpenMMLab packages. It simplifies the installation of complex deep learning libraries, especially those with specific CUDA and PyTorch dependencies, by providing a unified interface for installation, downloading models, and dataset management. It aims to reduce common installation pitfalls for OpenMMLab projects. The current version is 0.3.10, and it generally releases new versions every 1-2 months.","status":"active","version":"0.3.10","language":"python","source_language":"en","source_url":"https://github.com/open-mmlab/mim","tags":["OpenMMLab","ML","deep learning","package manager","CLI","model downloader"],"install":[{"cmd":"pip install openmim","lang":"bash","label":"Install openmim"}],"dependencies":[],"imports":[{"note":"OpenMMLab's MIM is primarily a command-line interface tool. While it can be invoked directly from the shell as 'mim', using 'python -m mim' programmatically (e.g., via subprocess) ensures the correct Python environment is used. There are no direct Python imports like `from mim import install` for end-user functionality.","symbol":"mim","correct":"import subprocess\nsubprocess.run(['python', '-m', 'mim', 'command', 'args'])"}],"quickstart":{"code":"import subprocess\nimport sys\n\n# Install a core OpenMMLab package, e.g., mmcv-full (with CUDA support)\nprint('Installing mmcv-full using mim...')\ninstall_cmd = [sys.executable, '-m', 'mim', 'install', 'mmcv-full']\nresult = subprocess.run(install_cmd, capture_output=True, text=True)\nprint('STDOUT:', result.stdout)\nprint('STDERR:', result.stderr)\nif result.returncode == 0:\n    print('mmcv-full installed successfully.')\nelse:\n    print('Failed to install mmcv-full.')\n    \n# You can also download a pretrained model\nprint('\\nDownloading a MMYOLO model using mim...')\ndownload_cmd = [sys.executable, '-m', 'mim', 'download', 'mmyolo', '--config', 'yolov8_s_syncbn_fast_8xb16-500e_coco', '--dest', '.']\nresult = subprocess.run(download_cmd, capture_output=True, text=True)\nprint('STDOUT:', result.stdout)\nprint('STDERR:', result.stderr)\nif result.returncode == 0:\n    print('Model downloaded successfully.')\nelse:\n    print('Failed to download model.')","lang":"python","description":"This quickstart demonstrates how to use `openmim` programmatically to install an OpenMMLab package (like `mmcv-full`) and download a pretrained model configuration. `mim` handles complex dependencies, including CUDA toolkits for `mmcv-full`. The `python -m mim` invocation is used to ensure compatibility with the current Python environment."},"warnings":[{"fix":"Use `mim` for all OpenMMLab package installations and their core dependencies. If `pip` must be used for other parts of the project, ensure `mim` has full control over the OpenMMLab stack.","message":"Mixing `mim install` with direct `pip install` for core OpenMMLab dependencies (e.g., `mmcv`, `mmengine`) can lead to version conflicts or broken installations. It's recommended to let `mim` manage these core packages exclusively.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always invoke MIM using `python -m mim` instead of `mim` directly when executing from scripts or when in doubt about the active Python environment.","message":"For environments with multiple Python installations or complex PATH settings, using `python -m mim` is more reliable than just `mim` to ensure the correct Python interpreter and associated environment are used for the installation. This pattern was officially supported since v0.3.1.","severity":"gotcha","affected_versions":"< 0.3.1 (less robust)"},{"fix":"Upgrade to `openmim` version `0.3.6` or newer using `pip install --upgrade openmim`.","message":"Users on `openmim` versions older than `0.3.6` might encounter an `AssertionError` during initial setup due to an issue with `pip` and `setuptools` import order.","severity":"gotcha","affected_versions":"< 0.3.6"},{"fix":"Upgrade to `openmim` version `0.3.4` or newer to avoid `distutils.version` deprecation warnings.","message":"Older versions of `openmim` used `distutils.version` internally, which has been deprecated in Python. While this might not directly break user code, it could lead to warnings from the Python interpreter.","severity":"deprecated","affected_versions":"< 0.3.4"}],"env_vars":null,"search_vec":"'-2':69 '0.3.10':60 '1':68 'aim':47 'cli':77 'command':10 'command-lin':9 'common':50 'complex':22 'cuda':30 'current':57 'dataset':44 'deep':23,73 'depend':33 'download':41,79 'especi':26 'everi':67 'general':63 'instal':3,20,40,51 'interfac':38 'learn':24,74 'librari':25 'line':11 'manag':4,14,45,76 'mim':1,5 'ml':72 'model':42,78 'month':70 'new':65 'offici':8 'openmmlab':2,15,54,71 'packag':16,75 'pitfal':52 'project':55 'provid':35 'pytorch':32 'reduc':49 'releas':64 'simplifi':18 'specif':29 'unifi':37 'util':12 'version':58,66","created_at":"2026-04-14T03:38:55.063876+00:00","updated_at":"2026-04-17T14:03:03.547206+00:00","problems":[{"fix":"Use `python -m mim` instead of `mim` directly to explicitly invoke the `mim` module with the correct Python interpreter. Alternatively, ensure the Python environment's script directory is added to your system's PATH.","cause":"After `pip install openmim`, the `mim` executable might not be in your system's PATH, especially in complex Python environments or when the Python site-packages script directory isn't automatically added to PATH.","error":"mim: command not found"},{"fix":"This issue is often transient or related to specific `pip` versions. Ensure `pip` is up-to-date (`pip install --upgrade pip`). If the problem persists, try installing `aliyunsdkcore` manually first (`pip install aliyun-python-sdk-core`) before installing `openmim`.","cause":"This error occurs during the installation of `openmim` or its dependencies, specifically `opendatalab` which transitively depends on `aliyunsdkcore`. It often happens due to issues with metadata generation for `aliyunsdkcore` during `pip`'s resolution process.","error":"ModuleNotFoundError: No module named 'aliyunsdkcore'"},{"fix":"Ensure that your PyTorch installation and the system's CUDA toolkit (or the CUDA version specified in your environment) are perfectly aligned. It's often best to install PyTorch with a specific CUDA version first using `conda` or `pip` (e.g., `conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia`), and then use `mim install` for OpenMMLab packages, which will try to find compatible versions. Explicitly set `CUDA_HOME` if needed to prioritize the correct CUDA version.","cause":"This critical error arises when installing OpenMMLab packages (like `mmcv`) via `mim install`. It indicates that the CUDA version detected on your system (or in the environment) does not match the CUDA version with which your installed PyTorch was compiled, leading to incompatibility.","error":"The detected CUDA version (X.Y) mismatches the version that was used to compile PyTorch (A.B). Please make sure to use the same CUDA versions."},{"fix":"Downgrade your Python environment to a compatible version, such as Python 3.8, 3.9, or 3.10. Check the OpenMMLab documentation for the officially supported Python versions for your specific OpenMMLab project.","cause":"This error signifies an incompatibility with newer Python versions, specifically Python 3.12. The `pkgutil.ImpImporter` attribute has been deprecated and removed in Python 3.12, and `openmim` (or its underlying dependencies) might be using this deprecated functionality.","error":"AttributeError: module 'pkgutil' has no attribute 'ImpImporter'"},{"fix":"Ensure you are using `mim` exclusively for OpenMMLab package installations and their core dependencies. If using `pip` for other packages, ensure `mim` has full control over the OpenMMLab stack. If `pip` version is an issue, consider downgrading `pip` to a known compatible version (e.g., `pip<=24.0`) before running `mim install`. Always use `python -m mim install <package>` to ensure the correct environment.","cause":"This error occurs when you try to import an OpenMMLab package (like `mmpretrain` or `mmdet`) after installing it with `mim install`, but `mmcv` (a core dependency) was not installed correctly or is not accessible in the current Python environment. This can be caused by `pip` version conflicts (e.g., with `pip>=24.1`) or mixing `mim install` with direct `pip install` for core dependencies.","error":"ModuleNotFoundError: No module named 'mmcv'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.3.9","cli_name":"mim","cli_version":"mim, version 0.3.9","type":"library","homepage":"https://openmmlab.com","github":"https://github.com/open-mmlab/mim","docs":null,"changelog":null,"pypi":"https://pypi.org/project/openmim/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-30","next_check":"2026-07-28","install_tag":null}}