Installation¶
Install mmcv¶
Optional: install PyTorch¶
You can choose to install PyTorch separately by following the PyTorch official installation guide. However, if you use [uv] you don’t have to.
This can be verified using the following command
python -c 'import torch;print(torch.__version__)'
If version information is output, then PyTorch is installed.
Install with mim (recommended)¶
pip install onedl-mim
mim install onedl-mmcv[torch]
If the correct version of torch is not installed, follow the PyTorch official installation guide and install onedl-mmcv with
mim install onedl-mmcv
If you find that the above installation command does not use a pre-built package ending with .whl but a source package ending with .tar.gz, you may not have a pre-build package corresponding to the PyTorch or CUDA or mmcv version, in which case you can build mmcv from source.
Note
If you get an error messages that mentions something similar to ModuleNotFoundError: No module named 'mmcv._ext' it means you have a version installed without compiled ops. For a full overview of the pre-build wheels and versions we support you can look here.
Every cuda+torch version has it’s own subfolder, where the supported python versions and operating systems combinations can be found (currently only linux is supported). Make sure to clear you cache before trying to reinstall or use mim install onedl-mmcv --only-binary=onedl-mmcv.
If your combination is not there, it means we don’t have a pre-built wheel. Either change your torch+cuda and/or python version or build mmcv from source
Installation log using pre-built packages
Looking in links: https://mmwheels.onedl.ai/simple/cu126-torch2.4.1/index.html
Collecting onedl-mmcv
Downloading https://mmwheels.onedl.ai/simple/cu126-torch2.4.1/onedl-mmcv-2.0.0-cp38-cp38-manylinux1_x86_64.whl
Installation log using source packages
Looking in links: https://mmwheels.onedl.ai/simple/cu126-torch2.4.1/index.html
Collecting onedl-mmcv==2.3.0
Downloading onedl-mmcv-2.3.0.tar.gz
To install a specific version of onedl-mmcv, for example, onedl-mmcv version 2.3.0, you can use the following command
mim install onedl-mmcv==2.3.0
Note
If you would like to use opencv-python-headless instead of opencv-python,
e.g., in a minimum container environment or servers without GUI,
you can first install it before installing MMCV to skip the installation of opencv-python.
You can run check_installation.py to check the installation of onedl-mmcv after running the installation commands.
Install with pip¶
Use the following command to check the version of CUDA and PyTorch
python -c 'import torch;print(torch.__version__);print(torch.version.cuda)'
Select the appropriate installation command depending on the type of system, CUDA version, PyTorch version, and MMCV version
If you do not find a corresponding version in the dropdown box above, you probably do not have a pre-built package corresponding to the PyTorch or CUDA or mmcv version, at which point you can build mmcv from source.
Note
mmcv is only compiled on PyTorch 1.x.0 because the compatibility usually holds between 1.x.0 and 1.x.1. If your PyTorch version is 1.x.1, you can install mmcv compiled with PyTorch 1.x.0 and it usually works well. For example, if your PyTorch version is 1.8.1, you can feel free to choose 1.8.x.
Note
If you would like to use opencv-python-headless instead of opencv-python,
e.g., in a minimum container environment or servers without GUI,
you can first install it before installing MMCV to skip the installation of opencv-python.
You can run check_installation.py to check the installation of mmcv after running the installation commands.
Using mmcv with Docker
Build with local repository
git clone https://github.com/vbti-development/onedl-mmcv.git && cd mmcv
docker build -t mmcv -f docker/release/Dockerfile .
Or build with remote repository
docker build -t mmcv https://github.com/vbti-development/onedl-mmcv.git#main:docker/release
The Dockerfile installs latest released version of mmcv-full by default, but you can specify mmcv versions to install expected versions.
docker image build -t mmcv -f docker/release/Dockerfile --build-arg MMCV=2.3.0 .
If you also want to use other versions of PyTorch and CUDA, you can also pass them when building docker images.
An example to build an image with PyTorch 2.4.1 and CUDA 12.4.
docker build -t mmcv -f docker/release/Dockerfile \
--build-arg PYTORCH=2.4.1 \
--build-arg CUDA=12.4 \
--build-arg CUDNN=8 \
--build-arg MMCV=2.3.0 .
More available versions of PyTorch and CUDA can be found at dockerhub/pytorch.