PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

Paddle 访问了 np.sctypes 导致报错

Open Moskize91 opened this issue 10 months ago • 1 comments

🔎 Search before asking

  • [x] I have searched the PaddleOCR Docs and found no similar bug report.
  • [x] I have searched the PaddleOCR Issues and found no similar bug report.
  • [x] I have searched the PaddleOCR Discussions and found no similar bug report.

🐛 Bug (问题描述)

bug描述 Describe the Bug

引用 paddle 报错。

from paddleocr import PaddleOCR
Traceback (most recent call last):
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\scripts\analyse_pdf.py", line 8, in <module>
    from pdf_craft import PDFPageExtractor
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\pdf_craft\__init__.py", line 1, in <module>
    from .pdf import *
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\pdf_craft\pdf\__init__.py", line 1, in <module>
    from .extractor import Block, Text, TextKind, TextBlock, AssetKind, AssetBlock, PDFPageExtractor
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\pdf_craft\pdf\extractor.py", line 7, in <module>
    from doc_page_extractor import clip, PaddleLang, Rectangle, Layout, LayoutClass, OCRFragment, ExtractedResult
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\.venv\Lib\site-packages\doc_page_extractor\__init__.py", line 1, in <module>
    from .extractor import PaddleLang, DocExtractor
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\.venv\Lib\site-packages\doc_page_extractor\extractor.py", line 11, in <module>
    from .ocr import OCR, PaddleLang
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\.venv\Lib\site-packages\doc_page_extractor\ocr.py", line 6, in <module>
    from paddleocr import PaddleOCR
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\.venv\Lib\site-packages\paddleocr\__init__.py", line 14, in <module>
    from .paddleocr import (
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\.venv\Lib\site-packages\paddleocr\paddleocr.py", line 64, in <module>
    from tools.infer import predict_system
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\.venv\Lib\site-packages\paddleocr\tools\infer\predict_system.py", line 33, in <module>
    import tools.infer.predict_det as predict_det
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\.venv\Lib\site-packages\paddleocr\tools\infer\predict_det.py", line 31, in <module>
    from ppocr.data import create_operators, transform
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\.venv\Lib\site-packages\paddleocr\ppocr\data\__init__.py", line 35, in <module>
    from ppocr.data.imaug import transform, create_operators
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\.venv\Lib\site-packages\paddleocr\ppocr\data\imaug\__init__.py", line 19, in <module>
    from .iaa_augment import IaaAugment
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\.venv\Lib\site-packages\paddleocr\ppocr\data\imaug\iaa_augment.py", line 24, in <module>
    import imgaug
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\.venv\Lib\site-packages\imgaug\__init__.py", line 7, in <module>
    from imgaug.imgaug import *  # pylint: disable=redefined-builtin
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\.venv\Lib\site-packages\imgaug\imgaug.py", line 45, in <module>
    NP_FLOAT_TYPES = set(np.sctypes["float"])
                         ^^^^^^^^^^
  File "C:\Users\i\codes\github.com\oomol-lab\pdf-craft\.venv\Lib\site-packages\numpy\__init__.py", line 397, in __getattr__
    raise AttributeError(
AttributeError: `np.sctypes` was removed in the NumPy 2.0 release. Access dtypes explicitly instead.. Did you mean: 'dtypes'?

原问题 https://github.com/PaddlePaddle/Paddle/issues/71544。

🏃‍♂️ Environment (运行环境)

我的设备是 windows 11

处理器 13th Gen Intel(R) Core(TM) i7-13700K 3.40 GHz 机带 RAM 64.0 GB (63.8 GB 可用) 系统类型 64 位操作系统, 基于 x64 的处理器 版本号 24H2 操作系统版本 26100.3194

使用这个教程安装的 conda 版 Paddle 的 GPU 版本。

using CUDA 11.2 cuDNN 8.2.1 Python 3.12.7 conda 24.11.3

$ pip show num numpy
Name: numpy
Version: 1.26.4

🌰 Minimal Reproducible Example (最小可复现问题的Demo)

import paddleocr
pip install doclayout_yolo==0.0.3 opencv-python==4.11.0.86  paddlepaddle==2.6.2 paddleocr==2.9.0

Moskize91 avatar Mar 12 '25 05:03 Moskize91

paddleocr 2.9 不支持 numpy 2.0

GreatV avatar Mar 14 '25 06:03 GreatV

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar Sep 03 '25 02:09 github-actions[bot]