PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
https://paddlepaddle.github.io/PaddleOCR/
Apache License 2.0
42.81k stars 7.69k forks source link

ImportError: cannot import name '_registerMatType' from 'cv2.cv2' #5800

Closed djkcyl closed 2 years ago

djkcyl commented 2 years ago
  File "/A60/ABot-Graia/util/ocr.py", line 3, in <module>
    import paddleocr.paddleocr as pocr

  File "/A60/ABot-Graia/virtualenvs/abot-mahv2-KViQ_pum-py3.9/lib/python3.9/site-packages/paddleocr/__init__.py", line 14, in <module>
    from .paddleocr import *
  File "/A60/ABot-Graia/virtualenvs/abot-mahv2-KViQ_pum-py3.9/lib/python3.9/site-packages/paddleocr/paddleocr.py", line 25, in <module>
    import cv2
  File "/A60/ABot-Graia/virtualenvs/abot-mahv2-KViQ_pum-py3.9/lib/python3.9/site-packages/cv2/__init__.py", line 9, in <module>
    from .cv2 import _registerMatType

ImportError: cannot import name '_registerMatType' from 'cv2.cv2' (/A60/ABot-Graia/virtualenvs/abot-mahv2-KViQ_pum-py3.9/lib/python3.9/site-packages/cv2/cv2.cpython-39-x86_64-linux-gnu.so)
djkcyl commented 2 years ago

目测是依赖问题

paddleocr 2.4.0.3 Awesome OCR toolkits based on PaddlePaddle (8.6M ultra-lightweight pre-trained model, support training and deployment among server, mobile, embeded and IoT devices
├── cython *
├── fasttext 0.9.1
│   ├── numpy * 
│   └── pybind11 >=2.2 
├── imgaug 0.4.0
│   ├── imageio * 
│   │   ├── numpy * 
│   │   └── pillow >=8.3.2 
│   ├── matplotlib * 
│   │   ├── cycler >=0.10 
│   │   ├── fonttools >=4.22.0 
│   │   ├── kiwisolver >=1.0.1 
│   │   ├── numpy >=1.17 (circular dependency aborted here)
│   │   ├── packaging >=20.0 
│   │   │   └── pyparsing >=2.0.2,<3.0.5 || >3.0.5 
│   │   ├── pillow >=6.2.0 (circular dependency aborted here)
│   │   ├── pyparsing >=2.2.1 (circular dependency aborted here)
│   │   ├── python-dateutil >=2.7 
│   │   │   └── six >=1.5 
│   │   └── setuptools-scm >=4 
│   │       ├── packaging >=20.0 (circular dependency aborted here)
│   │       └── tomli >=1.0.0 
│   ├── numpy >=1.15 (circular dependency aborted here)
│   ├── opencv-python * 
│   │   └── numpy >=1.19.3 (circular dependency aborted here)
│   ├── pillow * (circular dependency aborted here)
│   ├── scikit-image >=0.14.2 
│   │   ├── imageio >=2.4.1 (circular dependency aborted here)
│   │   ├── networkx >=2.2 
│   │   ├── numpy >=1.17.0 (circular dependency aborted here)
│   │   ├── packaging >=20.0 (circular dependency aborted here)
│   │   ├── pillow >=6.1.0,<7.1.0 || >7.1.0,<7.1.1 || >7.1.1,<8.3.0 || >8.3.0 (circular dependency aborted here)
│   │   ├── pywavelets >=1.1.1 
│   │   │   └── numpy >=1.17.3 (circular dependency aborted here)
│   │   ├── scipy >=1.4.1 
│   │   │   └── numpy >=1.16.5,<1.23.0 (circular dependency aborted here)
│   │   └── tifffile >=2019.7.26 
│   │       └── numpy >=1.15.1 (circular dependency aborted here)
│   ├── scipy * (circular dependency aborted here)
│   ├── shapely * 
│   └── six * (circular dependency aborted here)
├── lmdb *
├── lxml *
├── numpy *
├── opencv-contrib-python 4.4.0.46
│   └── numpy >=1.19.3 
├── openpyxl *
│   └── et-xmlfile * 
├── premailer *
│   ├── cachetools * 
│   ├── cssselect * 
│   ├── cssutils * 
│   ├── lxml * 
│   └── requests * 
│       ├── certifi >=2017.4.17 
│       ├── chardet >=3.0.2,<4 
│       ├── idna >=2.5,<3 
│       └── urllib3 >=1.21.1,<1.25.0 || >1.25.0,<1.25.1 || >1.25.1,<1.26 
├── pyclipper *
├── python-levenshtein *
├── scikit-image *
│   ├── imageio >=2.4.1 
│   │   ├── numpy * 
│   │   └── pillow >=8.3.2 
│   ├── networkx >=2.2 
│   ├── numpy >=1.17.0 (circular dependency aborted here)
│   ├── packaging >=20.0 
│   │   └── pyparsing >=2.0.2,<3.0.5 || >3.0.5 
│   ├── pillow >=6.1.0,<7.1.0 || >7.1.0,<7.1.1 || >7.1.1,<8.3.0 || >8.3.0 (circular dependency aborted here)
│   ├── pywavelets >=1.1.1 
│   │   └── numpy >=1.17.3 (circular dependency aborted here)
│   ├── scipy >=1.4.1 
│   │   └── numpy >=1.16.5,<1.23.0 (circular dependency aborted here)
│   └── tifffile >=2019.7.26 
│       └── numpy >=1.15.1 (circular dependency aborted here)
├── shapely *
├── tqdm *
│   └── colorama * 
└── visualdl *
    ├── bce-python-sdk * 
    │   ├── future >=0.6.0 
    │   ├── pycryptodome >=3.8.0 
    │   └── six >=1.4.0 
    ├── flake8 >=3.7.9 
    │   ├── mccabe >=0.6.0,<0.7.0 
    │   ├── pycodestyle >=2.8.0,<2.9.0 
    │   └── pyflakes >=2.4.0,<2.5.0 
    ├── flask >=1.1.1 
    │   ├── click >=7.1.2 
    │   │   └── colorama * 
    │   ├── itsdangerous >=2.0 
    │   ├── jinja2 >=3.0 
    │   │   └── markupsafe >=2.0 
    │   └── werkzeug >=2.0 
    ├── flask-babel >=1.0.0 
    │   ├── babel >=2.3 
    │   │   └── pytz >=2015.7 
    │   ├── flask * (circular dependency aborted here)
    │   ├── jinja2 >=2.5 (circular dependency aborted here)
    │   └── pytz * (circular dependency aborted here)
    ├── matplotlib * 
    │   ├── cycler >=0.10 
    │   ├── fonttools >=4.22.0 
    │   ├── kiwisolver >=1.0.1 
    │   ├── numpy >=1.17 
    │   ├── packaging >=20.0 
    │   │   └── pyparsing >=2.0.2,<3.0.5 || >3.0.5 
    │   ├── pillow >=6.2.0 
    │   ├── pyparsing >=2.2.1 (circular dependency aborted here)
    │   ├── python-dateutil >=2.7 
    │   │   └── six >=1.5 (circular dependency aborted here)
    │   └── setuptools-scm >=4 
    │       ├── packaging >=20.0 (circular dependency aborted here)
    │       └── tomli >=1.0.0 
    ├── numpy * (circular dependency aborted here)
    ├── pandas * 
    │   ├── numpy >=1.17.3 (circular dependency aborted here)
    │   ├── python-dateutil >=2.7.3 (circular dependency aborted here)
    │   └── pytz >=2017.3 (circular dependency aborted here)
    ├── pillow >=7.0.0 (circular dependency aborted here)
    ├── pre-commit * 
    │   ├── cfgv >=2.0.0 
    │   ├── identify >=1.0.0 
    │   ├── nodeenv >=0.11.1 
    │   ├── pyyaml >=5.1 
    │   ├── toml * 
    │   └── virtualenv >=20.0.8 
    │       ├── distlib >=0.3.1,<1 
    │       ├── filelock >=3.2,<4 
    │       ├── platformdirs >=2,<3 
    │       └── six >=1.9.0,<2 (circular dependency aborted here)
    ├── protobuf >=3.11.0 
    ├── requests * 
    │   ├── certifi >=2017.4.17 
    │   ├── chardet >=3.0.2,<4 
    │   ├── idna >=2.5,<3 
    │   └── urllib3 >=1.21.1,<1.25.0 || >1.25.0,<1.25.1 || >1.25.1,<1.26 
    ├── shellcheck-py * 
    └── six >=1.14.0 (circular dependency aborted here)
djkcyl commented 2 years ago

问题解决

手动修改版本使 opencv-python 和 opencv-contrib-python 版本一样即可