2021-07-02 20:53:00 +08:00
## Installation
There are two versions of MMCV:
2022-08-30 16:24:06 +08:00
- **mmcv**: comprehensive, with full features and various CUDA ops out of box. It takes longer time to build.
- **mmcv-lite**: lite, without CUDA ops but all other features, similar to mmcv\<1.0.0. It is useful when you do not need those CUDA ops.
2021-07-02 20:53:00 +08:00
2021-08-22 09:44:51 +08:00
```{warning}
2021-10-04 20:13:54 +08:00
Do not install both versions in the same environment, otherwise you may encounter errors like `ModuleNotFound` . You need to uninstall one before installing the other. `Installing the full version is highly recommended if CUDA is avaliable` .
2021-08-22 09:44:51 +08:00
```
2021-07-02 20:53:00 +08:00
a. Install the full version.
2022-10-10 12:41:10 +08:00
Before installing mmcv, make sure that PyTorch has been successfully installed following the [official guide ](https://pytorch.org/ ). For macOS M1 users, please make sure you are using `PyTorch Nightly` .
2021-07-02 20:53:00 +08:00
2022-08-30 19:01:34 +08:00
We provide pre-built mmcv packages (recommended) with different PyTorch and CUDA versions to simplify the building for **Linux and Windows systems** . In addition, you can run [check_installation.py ](https://github.com/open-mmlab/mmcv/blob/2.x/.dev_scripts/check_installation.py ) to check the installation of mmcv after running the installation commands.
2021-07-02 20:53:00 +08:00
i. Install the latest version.
2022-08-30 16:24:06 +08:00
The rule for installing the latest `mmcv` is as follows:
2021-07-02 20:53:00 +08:00
```shell
2022-08-30 16:24:06 +08:00
pip install 'mmcv>=2.0.0rc1' -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
2021-07-02 20:53:00 +08:00
```
2022-05-16 20:47:56 +08:00
Please replace `{cu_version}` and `{torch_version}` in the url to your desired one. For example,
2022-08-30 16:24:06 +08:00
to install the latest `mmcv` with `CUDA 11.1` and `PyTorch 1.9.0` , use the following command:
2021-07-02 20:53:00 +08:00
```shell
2022-08-30 16:24:06 +08:00
pip install 'mmcv>=2.0.0rc1' -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
2021-07-02 20:53:00 +08:00
```
2022-05-16 20:47:56 +08:00
For more details, please refer the the following tables and delete `=={mmcv_version}` .
2021-07-02 20:53:00 +08:00
ii. Install a specified version.
2022-08-30 16:24:06 +08:00
The rule for installing a specified `mmcv` is as follows:
2021-07-02 20:53:00 +08:00
```shell
2022-08-30 16:24:06 +08:00
pip install mmcv=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
2021-07-02 20:53:00 +08:00
```
2022-08-30 16:24:06 +08:00
First of all, please refer to the Releases and replace `{mmcv_version}` a specified one. e.g. `2.0.0rc1` .
2022-05-16 20:47:56 +08:00
Then replace `{cu_version}` and `{torch_version}` in the url to your desired versions. For example,
2022-08-30 16:24:06 +08:00
to install `mmcv==2.0.0rc1` with `CUDA 11.1` and `PyTorch 1.9.0` , use the following command:
2021-07-02 20:53:00 +08:00
```shell
2022-08-30 16:24:06 +08:00
pip install mmcv==2.0.0rc1 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
2021-07-02 20:53:00 +08:00
```
2021-11-02 23:37:56 +08:00
```{note}
2022-08-30 16:24:06 +08:00
mmcv is only compiled on PyTorch 1.x.0 because the compatibility
2021-10-13 20:25:49 +08:00
usually holds between 1.x.0 and 1.x.1. If your PyTorch version is 1.x.1, you
2022-08-30 16:24:06 +08:00
can install mmcv compiled with PyTorch 1.x.0 and it usually works well.
2021-10-13 20:25:49 +08:00
For example, if your PyTorch version is 1.8.1 and CUDA version is 11.1, you
2022-08-30 16:24:06 +08:00
can use the following command to install mmcv.
2021-10-13 20:25:49 +08:00
2022-08-30 16:24:06 +08:00
`pip install mmcv==2.0.0rc1 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html`
2021-10-13 20:25:49 +08:00
```
2021-07-02 20:53:00 +08:00
For more details, please refer the the following tables.
< table class = "docutils" >
< tbody >
< tr >
< th width = "80" > CUDA < / th >
2022-08-30 19:01:34 +08:00
< th valign = "bottom" align = "left" width = "120" > torch 1.12< / th >
2022-03-23 23:41:51 +08:00
< th valign = "bottom" align = "left" width = "120" > torch 1.11< / th >
< th valign = "bottom" align = "left" width = "120" > torch 1.10< / th >
< th valign = "bottom" align = "left" width = "120" > torch 1.9< / th >
< th valign = "bottom" align = "left" width = "120" > torch 1.8< / th >
< th valign = "bottom" align = "left" width = "120" > torch 1.7< / th >
< th valign = "bottom" align = "left" width = "120" > torch 1.6< / th >
2022-08-30 19:01:34 +08:00
< / tr >
< tr >
< td align = "left" > 11.6< / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.12.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
2022-03-23 23:41:51 +08:00
< / tr >
< tr >
< td align = "left" > 11.5< / td >
2022-08-30 19:01:34 +08:00
< td align = "left" > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu115/torch1.11.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
2022-03-23 23:41:51 +08:00
< td align = "left" > < / td >
< td align = "left" > < / td >
2021-07-02 20:53:00 +08:00
< / tr >
2021-11-23 21:36:18 +08:00
< tr >
< td align = "left" > 11.3< / td >
2022-08-30 19:01:34 +08:00
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.12.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.11.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
2021-11-23 21:36:18 +08:00
< td align = "left" > < / td >
< / tr >
2021-07-02 20:53:00 +08:00
< tr >
< td align = "left" > 11.1< / td >
2022-08-30 19:01:34 +08:00
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.10.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html< / code > < / pre > < / details > < / td >
2021-07-02 20:53:00 +08:00
< td align = "left" > < / td >
< td align = "left" > < / td >
< / tr >
< tr >
< td align = "left" > 11.0< / td >
2022-08-30 19:01:34 +08:00
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < / td >
2021-07-02 20:53:00 +08:00
< / tr >
< tr >
< td align = "left" > 10.2< / td >
2022-08-30 19:01:34 +08:00
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.12.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.11.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.9.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.7.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.6.0/index.html< / code > < / pre > < / details > < / td >
2021-07-02 20:53:00 +08:00
< / tr >
< tr >
< td align = "left" > 10.1< / td >
2022-08-30 19:01:34 +08:00
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.8.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html< / code > < / pre > < / details > < / td >
2021-07-02 20:53:00 +08:00
< / tr >
< tr >
< td align = "left" > 9.2< / td >
2022-08-30 19:01:34 +08:00
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.7.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.6.0/index.html< / code > < / pre > < / details > < / td >
2021-07-02 20:53:00 +08:00
< / tr >
< tr >
< td align = "left" > cpu< / td >
2022-08-30 19:01:34 +08:00
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.12.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.11.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.10.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.9.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.8.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.7.0/index.html< / code > < / pre > < / details > < / td >
< td align = "left" > < details > < summary > install < / summary > < pre > < code > pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.6.0/index.html< / code > < / pre > < / details > < / td >
2021-07-02 20:53:00 +08:00
< / tr >
< / tbody >
< / table >
2021-11-02 23:37:56 +08:00
```{note}
2022-08-30 16:24:06 +08:00
mmcv does not provide pre-built packages for `cu102-torch1.11` and `cu92-torch*` on Windows.
2022-03-23 23:41:51 +08:00
```
2021-07-02 20:53:00 +08:00
Another way is to compile locally by running
```python
2022-08-30 16:24:06 +08:00
pip install 'mmcv>=2.0.0rc1'
2021-07-02 20:53:00 +08:00
```
Note that the local compiling may take up to 10 mins.
b. Install the lite version.
```python
2022-08-30 16:24:06 +08:00
pip install mmcv-lite
2021-07-02 20:53:00 +08:00
```
2022-08-30 19:01:34 +08:00
If you would like to build MMCV from source, please refer to the [guide ](build.md ).