Solve the problem: ModuleNotFoundError: No module named 'mmcv._ext', and a detailed tutorial on installing mmcv-full

insert image description here

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:

  1. mmcv contains the core components of mmcv, such as runners, callback functions, visualization tools, etc., with a small package size.
  2. 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.
  3. mmcv is more lightweight and suitable for limited computing resources. mmcv-full provides more features but requires more resources.
  4. 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.
  5. Some functions need to rely on mmcv-full, such as video processing, Camp visualization, etc.
  6. If you encounter import errors, you may need to switch from mmcv to mmcv-full.
  7. mmcv-full depends on some system libraries, and the installation may fail in some environments.
  8. 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:

insert image description here

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:

insert image description here

Just click the blue link above to download it. After downloading, it looks like this:

insert image description here

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:

insert image description here
The above is to solve the problem: ModuleNotFoundError: No module named 'mmcv._ext', and the detailed tutorial for installing mmcv-full, thank you!

Guess you like

Origin blog.csdn.net/qq_40280673/article/details/132146267