Is the newest version of PaddleOCR compatible with Numpy v2? #16341
Unanswered
zixinnie-rti
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
System is using Python 3.11,
numpy 2.2.6,
PaddleOCR 3.2.0,
PaddlePaddle 3.1.1
After attempting to import PaddleOCR, I get the following error
from paddleocr import PaddleOCR
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.2.6 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
Traceback (most recent call last): File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/opt/conda/lib/python3.11/site-packages/ipykernel_launcher.py", line 17, in
app.launch_new_instance()
File "/opt/conda/lib/python3.11/site-packages/traitlets/config/application.py", line 1053, in launch_instance
app.start()
File "/opt/conda/lib/python3.11/site-packages/ipykernel/kernelapp.py", line 736, in start
self.io_loop.start()
File "/opt/conda/lib/python3.11/site-packages/tornado/platform/asyncio.py", line 195, in start
self.asyncio_loop.run_forever()
File "/opt/conda/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
self._run_once()
File "/opt/conda/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
handle._run()
File "/opt/conda/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/opt/conda/lib/python3.11/site-packages/ipykernel/kernelbase.py", line 516, in dispatch_queue
await self.process_one()
File "/opt/conda/lib/python3.11/site-packages/ipykernel/kernelbase.py", line 505, in process_one
await dispatch(*args)
File "/opt/conda/lib/python3.11/site-packages/ipykernel/kernelbase.py", line 412, in dispatch_shell
await result
File "/opt/conda/lib/python3.11/site-packages/ipykernel/kernelbase.py", line 740, in execute_request
reply_content = await reply_content
File "/opt/conda/lib/python3.11/site-packages/ipykernel/ipkernel.py", line 422, in do_execute
res = shell.run_cell(
File "/opt/conda/lib/python3.11/site-packages/ipykernel/zmqshell.py", line 546, in run_cell
return super().run_cell(*args, **kwargs)
File "/opt/conda/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3024, in run_cell
result = self._run_cell(
File "/opt/conda/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3079, in _run_cell
result = runner(coro)
File "/opt/conda/lib/python3.11/site-packages/IPython/core/async_helpers.py", line 129, in pseudo_sync_runner
coro.send(None)
File "/opt/conda/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3284, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File "/opt/conda/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3466, in run_ast_nodes
if await self.run_code(code, result, async=asy):
File "/opt/conda/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3526, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "/tmp/ipykernel_4940/1523400855.py", line 1, in
from paddleocr import PaddleOCR
File "/opt/conda/lib/python3.11/site-packages/paddleocr/init.py", line 15, in
from paddlex.inference.utils.benchmark import benchmark
File "/opt/conda/lib/python3.11/site-packages/paddlex/init.py", line 49, in
from .inference import create_pipeline, create_predictor
File "/opt/conda/lib/python3.11/site-packages/paddlex/inference/init.py", line 16, in
from .models import create_predictor
File "/opt/conda/lib/python3.11/site-packages/paddlex/inference/models/init.py", line 26, in
from .anomaly_detection import UadPredictor
File "/opt/conda/lib/python3.11/site-packages/paddlex/inference/models/anomaly_detection/init.py", line 15, in
from .predictor import UadPredictor
File "/opt/conda/lib/python3.11/site-packages/paddlex/inference/models/anomaly_detection/predictor.py", line 19, in
from ....modules.anomaly_detection.model_list import MODELS
File "/opt/conda/lib/python3.11/site-packages/paddlex/modules/init.py", line 91, in
from .ts_anomaly_detection import (
File "/opt/conda/lib/python3.11/site-packages/paddlex/modules/ts_anomaly_detection/init.py", line 16, in
from .dataset_checker import TSADDatasetChecker
File "/opt/conda/lib/python3.11/site-packages/paddlex/modules/ts_anomaly_detection/dataset_checker/init.py", line 26, in
from .dataset_src import check, convert, deep_analyse, split_dataset
File "/opt/conda/lib/python3.11/site-packages/paddlex/modules/ts_anomaly_detection/dataset_checker/dataset_src/init.py", line 17, in
from .check_dataset import check
File "/opt/conda/lib/python3.11/site-packages/paddlex/modules/ts_anomaly_detection/dataset_checker/dataset_src/check_dataset.py", line 20, in
import pandas as pd
File "/opt/conda/lib/python3.11/site-packages/pandas/init.py", line 49, in
from pandas.core.api import (
File "/opt/conda/lib/python3.11/site-packages/pandas/core/api.py", line 28, in
from pandas.core.arrays import Categorical
File "/opt/conda/lib/python3.11/site-packages/pandas/core/arrays/init.py", line 1, in
from pandas.core.arrays.arrow import ArrowExtensionArray
File "/opt/conda/lib/python3.11/site-packages/pandas/core/arrays/arrow/init.py", line 5, in
from pandas.core.arrays.arrow.array import ArrowExtensionArray
File "/opt/conda/lib/python3.11/site-packages/pandas/core/arrays/arrow/array.py", line 52, in
from pandas.core import (
File "/opt/conda/lib/python3.11/site-packages/pandas/core/ops/init.py", line 8, in
from pandas.core.ops.array_ops import (
File "/opt/conda/lib/python3.11/site-packages/pandas/core/ops/array_ops.py", line 56, in
from pandas.core.computation import expressions
File "/opt/conda/lib/python3.11/site-packages/pandas/core/computation/expressions.py", line 21, in
from pandas.core.computation.check import NUMEXPR_INSTALLED
File "/opt/conda/lib/python3.11/site-packages/pandas/core/computation/check.py", line 5, in
ne = import_optional_dependency("numexpr", errors="warn")
File "/opt/conda/lib/python3.11/site-packages/pandas/compat/_optional.py", line 135, in import_optional_dependency
module = importlib.import_module(name)
File "/opt/conda/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/opt/conda/lib/python3.11/site-packages/numexpr/init.py", line 24, in
from numexpr.interpreter import MAX_THREADS, use_vml, BLOCK_SIZE1
AttributeError Traceback (most recent call last)
AttributeError: _ARRAY_API not found
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.2.6 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
Traceback (most recent call last): File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/opt/conda/lib/python3.11/site-packages/ipykernel_launcher.py", line 17, in
app.launch_new_instance()
File "/opt/conda/lib/python3.11/site-packages/traitlets/config/application.py", line 1053, in launch_instance
app.start()
File "/opt/conda/lib/python3.11/site-packages/ipykernel/kernelapp.py", line 736, in start
self.io_loop.start()
File "/opt/conda/lib/python3.11/site-packages/tornado/platform/asyncio.py", line 195, in start
self.asyncio_loop.run_forever()
File "/opt/conda/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
self._run_once()
File "/opt/conda/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
handle._run()
File "/opt/conda/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/opt/conda/lib/python3.11/site-packages/ipykernel/kernelbase.py", line 516, in dispatch_queue
await self.process_one()
File "/opt/conda/lib/python3.11/site-packages/ipykernel/kernelbase.py", line 505, in process_one
await dispatch(*args)
File "/opt/conda/lib/python3.11/site-packages/ipykernel/kernelbase.py", line 412, in dispatch_shell
await result
File "/opt/conda/lib/python3.11/site-packages/ipykernel/kernelbase.py", line 740, in execute_request
reply_content = await reply_content
File "/opt/conda/lib/python3.11/site-packages/ipykernel/ipkernel.py", line 422, in do_execute
res = shell.run_cell(
File "/opt/conda/lib/python3.11/site-packages/ipykernel/zmqshell.py", line 546, in run_cell
return super().run_cell(*args, **kwargs)
File "/opt/conda/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3024, in run_cell
result = self._run_cell(
File "/opt/conda/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3079, in _run_cell
result = runner(coro)
File "/opt/conda/lib/python3.11/site-packages/IPython/core/async_helpers.py", line 129, in pseudo_sync_runner
coro.send(None)
File "/opt/conda/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3284, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File "/opt/conda/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3466, in run_ast_nodes
if await self.run_code(code, result, async=asy):
File "/opt/conda/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3526, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "/tmp/ipykernel_4940/1523400855.py", line 1, in
from paddleocr import PaddleOCR
File "/opt/conda/lib/python3.11/site-packages/paddleocr/init.py", line 15, in
from paddlex.inference.utils.benchmark import benchmark
File "/opt/conda/lib/python3.11/site-packages/paddlex/init.py", line 49, in
from .inference import create_pipeline, create_predictor
File "/opt/conda/lib/python3.11/site-packages/paddlex/inference/init.py", line 16, in
from .models import create_predictor
File "/opt/conda/lib/python3.11/site-packages/paddlex/inference/models/init.py", line 26, in
from .anomaly_detection import UadPredictor
File "/opt/conda/lib/python3.11/site-packages/paddlex/inference/models/anomaly_detection/init.py", line 15, in
from .predictor import UadPredictor
File "/opt/conda/lib/python3.11/site-packages/paddlex/inference/models/anomaly_detection/predictor.py", line 19, in
from ....modules.anomaly_detection.model_list import MODELS
File "/opt/conda/lib/python3.11/site-packages/paddlex/modules/init.py", line 91, in
from .ts_anomaly_detection import (
File "/opt/conda/lib/python3.11/site-packages/paddlex/modules/ts_anomaly_detection/init.py", line 16, in
from .dataset_checker import TSADDatasetChecker
File "/opt/conda/lib/python3.11/site-packages/paddlex/modules/ts_anomaly_detection/dataset_checker/init.py", line 26, in
from .dataset_src import check, convert, deep_analyse, split_dataset
File "/opt/conda/lib/python3.11/site-packages/paddlex/modules/ts_anomaly_detection/dataset_checker/dataset_src/init.py", line 17, in
from .check_dataset import check
File "/opt/conda/lib/python3.11/site-packages/paddlex/modules/ts_anomaly_detection/dataset_checker/dataset_src/check_dataset.py", line 20, in
import pandas as pd
File "/opt/conda/lib/python3.11/site-packages/pandas/init.py", line 49, in
from pandas.core.api import (
File "/opt/conda/lib/python3.11/site-packages/pandas/core/api.py", line 28, in
from pandas.core.arrays import Categorical
File "/opt/conda/lib/python3.11/site-packages/pandas/core/arrays/init.py", line 1, in
from pandas.core.arrays.arrow import ArrowExtensionArray
File "/opt/conda/lib/python3.11/site-packages/pandas/core/arrays/arrow/init.py", line 5, in
from pandas.core.arrays.arrow.array import ArrowExtensionArray
File "/opt/conda/lib/python3.11/site-packages/pandas/core/arrays/arrow/array.py", line 66, in
from pandas.core.arrays.masked import BaseMaskedArray
File "/opt/conda/lib/python3.11/site-packages/pandas/core/arrays/masked.py", line 61, in
from pandas.core import (
File "/opt/conda/lib/python3.11/site-packages/pandas/core/nanops.py", line 52, in
bn = import_optional_dependency("bottleneck", errors="warn")
File "/opt/conda/lib/python3.11/site-packages/pandas/compat/_optional.py", line 135, in import_optional_dependency
module = importlib.import_module(name)
File "/opt/conda/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/opt/conda/lib/python3.11/site-packages/bottleneck/init.py", line 7, in
from .move import (move_argmax, move_argmin, move_max, move_mean, move_median,
AttributeError Traceback (most recent call last)
AttributeError: _ARRAY_API not found
ValueError Traceback (most recent call last)
Cell In[1], line 1
----> 1 from paddleocr import PaddleOCR
File /opt/conda/lib/python3.11/site-packages/paddleocr/init.py:15
1 # Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
(...)
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
---> 15 from paddlex.inference.utils.benchmark import benchmark
17 from ._models import (
18 ChartParsing,
19 DocImgOrientationClassification,
(...)
30 TextRecognition,
31 )
32 from ._pipelines import (
33 DocPreprocessor,
34 DocUnderstanding,
(...)
41 TableRecognitionPipelineV2,
42 )
File /opt/conda/lib/python3.11/site-packages/paddlex/init.py:49
44 from . import version
46 version = version.get_pdx_version()
---> 49 from .inference import create_pipeline, create_predictor
50 from .model import create_model
51 from .modules import build_dataset_checker, build_evaluator, build_trainer
File /opt/conda/lib/python3.11/site-packages/paddlex/inference/init.py:16
1 # Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
(...)
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 from ..utils import logging
---> 16 from .models import create_predictor
17 from .pipelines import create_pipeline, load_pipeline_config
18 from .utils.hpi import HPIConfig
File /opt/conda/lib/python3.11/site-packages/paddlex/inference/models/init.py:26
22 from ..utils.official_models import official_models
24 # from .table_recognition import TablePredictor
25 # from .general_recognition import ShiTuRecPredictor
---> 26 from .anomaly_detection import UadPredictor
27 from .base import BasePredictor
28 from .doc_vlm import DocVLMPredictor
File /opt/conda/lib/python3.11/site-packages/paddlex/inference/models/anomaly_detection/init.py:15
1 # Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
(...)
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
---> 15 from .predictor import UadPredictor
File /opt/conda/lib/python3.11/site-packages/paddlex/inference/models/anomaly_detection/predictor.py:25
23 from ..base import BasePredictor
24 from ..common import Normalize, Resize, ToBatch, ToCHWImage
---> 25 from .processors import MapToMask
26 from .result import UadResult
29 class UadPredictor(BasePredictor):
File /opt/conda/lib/python3.11/site-packages/paddlex/inference/models/anomaly_detection/processors.py:21
18 from ...utils.benchmark import benchmark
20 if is_dep_available("scikit-image"):
---> 21 from skimage import morphology
24 @benchmark.timeit
25 @class_requires_deps("scikit-image")
26 class MapToMask:
27 """Map_to_mask"""
File /opt/conda/lib/python3.11/site-packages/skimage/init.py:122
118 # We are not importing the rest of the scikit during the build
119 # process, as it may not be compiled yet
120 else:
121 try:
--> 122 from ._shared import geometry
123 del geometry
124 except ImportError as e:
File geometry.pyx:1, in init skimage._shared.geometry()
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
Beta Was this translation helpful? Give feedback.
All reactions