mmpose icon indicating copy to clipboard operation
mmpose copied to clipboard

installation error via opencv-python

Open Yamameeee opened this issue 3 years ago • 1 comments
trafficstars

Following your installation guide, I installed mmpose and other stuff. When opencv-python==4.6.0.66 is installed, mmpose and mmcv will raise an error like this:

AttributeError: partially initialized module 'cv2' has no attribute '_registerMatType' (most likely due to a circular import)

I solved this problem after downgrade to opencv-python==4.5.5.64.

Detailed error message:

>>> import mmcv
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/workspace/MultiTask/mmcv/mmcv/__init__.py", line 4, in <module>
    from .fileio import *
  File "/workspace/MultiTask/mmcv/mmcv/fileio/__init__.py", line 2, in <module>
    from .file_client import BaseStorageBackend, FileClient
  File "/workspace/MultiTask/mmcv/mmcv/fileio/file_client.py", line 15, in <module>
    from mmcv.utils.misc import has_method
  File "/workspace/MultiTask/mmcv/mmcv/utils/__init__.py", line 40, in <module>
    from .env import collect_env
  File "/workspace/MultiTask/mmcv/mmcv/utils/env.py", line 9, in <module>
    import cv2
  File "/opt/conda/lib/python3.8/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/opt/conda/lib/python3.8/site-packages/cv2/__init__.py", line 175, in bootstrap
    if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
  File "/opt/conda/lib/python3.8/site-packages/cv2/__init__.py", line 28, in __load_extra_py_code_for_module
    py_module = importlib.import_module(module_name)
  File "/opt/conda/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/opt/conda/lib/python3.8/site-packages/cv2/mat_wrapper/__init__.py", line 33, in <module>
    cv._registerMatType(Mat)
AttributeError: partially initialized module 'cv2' has no attribute '_registerMatType' (most likely due to a circular import)

Yamameeee avatar Jun 14 '22 06:06 Yamameeee

This issue seems to be related to the installation of opencv-python. You may refer to this issue: https://github.com/opencv/opencv-python/issues/591.

Please double-check if you have installed opencv-python correctly.

FYI,you can follow the installation guide here.

liqikai9 avatar Jun 14 '22 11:06 liqikai9