To solve the problem **ModuleNotFoundError: No module named 'mmcv._ext'**, you must first understand the relationship between mmcv and mmcv-full.
Both mmcv and mmcv-full are computer vision basic libraries for PyTorch. The main differences between the two are:
- mmcv contains the core components of mmcv, such as runners, callback functions, visualization tools, etc., with a small package size.
- mmcv-full contains all the components of mmcv, and also bundles some optional dependency packages, such as video operation, image enhancement, etc., so the package size is relatively large.
- mmcv is more lightweight and suitable for limited computing resources. mmcv-full provides more features but requires more resources.
- If you only need the basic functions of mmcv, choose to install mmcv first. If you need to use advanced features, you need to install mmcv-full.
- Some functions need to rely on mmcv-full, such as video processing, Camp visualization, etc.
- If you encounter import errors, you may need to switch from mmcv to mmcv-full.
- mmcv-full depends on some system libraries, and the installation may fail in some environments.
- It is generally recommended to try to install mmcv first, and then switch to mmcv-full if the function is insufficient.
So to solve this problem, you have to uninstall mmcv first, and then install mmcv-full, but installing mmcv-full is not as easy as installing mmcv directly. To install mmcv, you only need to command pip install mmcv to quickly install it, but pip install mmcv- full will report an error, as follows:
I tried a variety of methods, and finally chose to install the wheel of mmcv-full directly. The link to download the wheel of mmcv-full is: add link description
Which wheel to download here needs to be downloaded according to your computer environment, as follows:
Just click the blue link above to download it. After downloading, it looks like this:
Enter the virtual environment to be installed, and directly use the following command to successfully install mmcv-full:
pip install mmcv_full-1.4.0-cp38-cp38-win_amd64.whl
After the installation is successful, it looks like this:
The above is to solve the problem: ModuleNotFoundError: No module named 'mmcv._ext', and the detailed tutorial for installing mmcv-full, thank you!