-
Notifications
You must be signed in to change notification settings - Fork 7.8k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PaddleOcr do not work on mac anymore #11706
Comments
we've noticed several reports, e.g. : #11079, but has not been able to reproduce this issue. |
I tried to downgrade those libraries pandas, numpy, PyMuPDF, opencv-contrib-python, opencv-python, paddlepaddle, paddlepaddle. But unlucky nothing worked for me. |
@jzhang533 Since you cannot reproduce the issue. Can you share pls the entire requirement.txt on what worked for you on mac using: "pip freeze > requirements.txt" so then I can play with it? |
this tiny script works for me : https://gist.github.com/jzhang533/e19404f6879c8f4f9e73e02eb6a49d9d |
@LmYjQ What version of PyMuPDF do you have? I found out where my problem is but I don't know yet how to fix it. |
My problem is that I cannot install PyMuPDF version 1.20.2 as @jzhang533 suggested on his req: My full logs are here: More info about: brew info mupdf swig freetype ==> mupdf: stable 1.23.11 (bottled), HEAD ==> swig: stable 4.2.1 (bottled), HEAD ==> freetype: stable 2.13.2 (bottled) |
NEW UPDATES: I did debug the error on this package paddleocr==2.7.0.3 env6/lib/python3.12/site-packages/paddleocr/tools/infer/predict_det.py -> TextDetector -> call -> self.predictor.run() Line 233 makes the program stuck PS: I suspect the problem lies on build config and paddle inference is not able to deal with it. @jzhang533 Can you pls check what I added above probably you know any fix or work around how i can make it work at least on my development environment (on my laptop) |
CONFIRMED: WHAT I TRIED: The following code is on how I tested it each time and it has the same result and the same problem: "stuckkkkk 4ever".
|
@R4Ajeti thanks for narrow down this issue. |
while running locally in bazel sandboxed environment, getting segfault related
environment
source from absl import app
from absl import flags
from paddleocr import PaddleOCR
import paddle
_IMAGE_URI = flags.DEFINE_string("image_uri", None, "URI of the image to process.")
def main(argv: list[str]) -> None:
if len(argv) > 1:
raise ValueError("too many arguments")
paddle.utils.run_check()
ocr = PaddleOCR(use_angle_cls=True, lang="en")
res = ocr.ocr(_IMAGE_URI.value)
print(res)
if __name__ == "__main__":
app.run(main) output # equivalent to `python3 run main.py --image_uri=...`
~/Projects/xat> bazel run //paddle_ocr -- --image_uri="https://raw.githubusercontent.com/PaddlePaddle/PaddleOCR/69832ab5326c6db614af6fb74b530aeae1c9b80e/doc/imgs_en/254.jpg"
Running verify PaddlePaddle program ...
I0313 22:24:39.217947 4112169664 program_interpreter.cc:212] New Executor is Running.
I0313 22:24:39.337317 4112169664 interpreter_util.cc:624] Standalone Executor is Used.
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0313 22:24:39.338956 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339063 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339191 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339197 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339252 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339257 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339318 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339483 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339488 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339552 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339557 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339558 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339589 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339592 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339594 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339753 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339802 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339825 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339849 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339865 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339892 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339919 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339936 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.339953 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.340008 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.340013 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.340015 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.340016 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.340018 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.340020 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.340021 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.340087 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.340092 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.340094 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.340095 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.340097 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.340098 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
I0313 22:24:39.340101 4112169664 kernel_dispatch.h:102] Get BackendSet from tensor
PaddlePaddle works well on 1 CPU.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
[2024/03/13 22:24:39] ppocr DEBUG: Namespace(help='==SUPPRESS==', use_gpu=False, use_xpu=False, use_npu=False, ir_optim=True, use_tensorrt=False, min_subgraph_size=15, precision='fp32', gpu_mem=500, gpu_id=0, image_dir=None, page_num=0, det_algorithm='DB', det_model_dir='/Users/lev1ty/.paddleocr/whl/det/en/en_PP-OCRv3_det_infer', det_limit_side_len=960, det_limit_type='max', det_box_type='quad', det_db_thresh=0.3, det_db_box_thresh=0.6, det_db_unclip_ratio=1.5, max_batch_size=10, use_dilation=False, det_db_score_mode='fast', det_east_score_thresh=0.8, det_east_cover_thresh=0.1, det_east_nms_thresh=0.2, det_sast_score_thresh=0.5, det_sast_nms_thresh=0.2, det_pse_thresh=0, det_pse_box_thresh=0.85, det_pse_min_area=16, det_pse_scale=1, scales=[8, 16, 32], alpha=1.0, beta=1.0, fourier_degree=5, rec_algorithm='SVTR_LCNet', rec_model_dir='/Users/lev1ty/.paddleocr/whl/rec/en/en_PP-OCRv4_rec_infer', rec_image_inverse=True, rec_image_shape='3, 48, 320', rec_batch_num=6, max_text_length=25, rec_char_dict_path='/private/var/tmp/_bazel_lev1ty/3b8fb8eaf07df7eb5946fd70f125660d/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/paddle_ocr/paddle_ocr.runfiles/rules_python~~pip~pip_311_paddleocr/site-packages/paddleocr/ppocr/utils/en_dict.txt', use_space_char=True, vis_font_path='./doc/fonts/simfang.ttf', drop_score=0.5, e2e_algorithm='PGNet', e2e_model_dir=None, e2e_limit_side_len=768, e2e_limit_type='max', e2e_pgnet_score_thresh=0.5, e2e_char_dict_path='./ppocr/utils/ic15_dict.txt', e2e_pgnet_valid_set='totaltext', e2e_pgnet_mode='fast', use_angle_cls=True, cls_model_dir='/Users/lev1ty/.paddleocr/whl/cls/ch_ppocr_mobile_v2.0_cls_infer', cls_image_shape='3, 48, 192', label_list=['0', '180'], cls_batch_num=6, cls_thresh=0.9, enable_mkldnn=False, cpu_threads=10, use_pdserving=False, warmup=False, sr_model_dir=None, sr_image_shape='3, 32, 128', sr_batch_num=1, draw_img_save_dir='./inference_results', save_crop_res=False, crop_res_save_dir='./output', use_mp=False, total_process_num=1, process_id=0, benchmark=False, save_log_path='./log_output/', show_log=True, use_onnx=False, output='./output', table_max_len=488, table_algorithm='TableAttn', table_model_dir=None, merge_no_span_structure=True, table_char_dict_path=None, layout_model_dir=None, layout_dict_path=None, layout_score_threshold=0.5, layout_nms_threshold=0.5, kie_algorithm='LayoutXLM', ser_model_dir=None, re_model_dir=None, use_visual_backbone=True, ser_dict_path='../train_data/XFUND/class_list_xfun.txt', ocr_order_method=None, mode='structure', image_orientation=False, layout=True, table=True, ocr=True, recovery=False, use_pdf2docx_api=False, invert=False, binarize=False, alphacolor=(255, 255, 255), lang='en', det=True, rec=True, type='ocr', ocr_version='PP-OCRv4', structure_version='PP-StructureV2')
100%|█████████████████████████████████████████████████████████████████████████████| 65.2k/65.2k [00:00<00:00, 11.1MiB/s]
Fatal Python error: Segmentation fault
Thread 0x0000000343507000 (most recent call first):
File "/private/var/tmp/_bazel_lev1ty/3b8fb8eaf07df7eb5946fd70f125660d/external/rules_python~~python~python_3_11_7_aarch64-apple-darwin/lib/python3.11/threading.py", line 331 in wait
File "/private/var/tmp/_bazel_lev1ty/3b8fb8eaf07df7eb5946fd70f125660d/external/rules_python~~python~python_3_11_7_aarch64-apple-darwin/lib/python3.11/threading.py", line 629 in wait
File "/private/var/tmp/_bazel_lev1ty/3b8fb8eaf07df7eb5946fd70f125660d/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/paddle_ocr/paddle_ocr.runfiles/rules_python~~pip~pip_311_tqdm/site-packages/tqdm/_monitor.py", line 60 in run
File "/private/var/tmp/_bazel_lev1ty/3b8fb8eaf07df7eb5946fd70f125660d/external/rules_python~~python~python_3_11_7_aarch64-apple-darwin/lib/python3.11/threading.py", line 1045 in _bootstrap_inner
File "/private/var/tmp/_bazel_lev1ty/3b8fb8eaf07df7eb5946fd70f125660d/external/rules_python~~python~python_3_11_7_aarch64-apple-darwin/lib/python3.11/threading.py", line 1002 in _bootstrap
Current thread 0x00000001f51abac0 (most recent call first):
File "/private/var/tmp/_bazel_lev1ty/3b8fb8eaf07df7eb5946fd70f125660d/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/paddle_ocr/paddle_ocr.runfiles/rules_python~~pip~pip_311_paddleocr/site-packages/paddleocr/tools/infer/predict_det.py", line 245 in __call__
File "/private/var/tmp/_bazel_lev1ty/3b8fb8eaf07df7eb5946fd70f125660d/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/paddle_ocr/paddle_ocr.runfiles/rules_python~~pip~pip_311_paddleocr/site-packages/paddleocr/tools/infer/predict_system.py", line 76 in __call__
File "/private/var/tmp/_bazel_lev1ty/3b8fb8eaf07df7eb5946fd70f125660d/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/paddle_ocr/paddle_ocr.runfiles/rules_python~~pip~pip_311_paddleocr/site-packages/paddleocr/paddleocr.py", line 661 in ocr
File "/private/var/tmp/_bazel_lev1ty/3b8fb8eaf07df7eb5946fd70f125660d/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/paddle_ocr/paddle_ocr.runfiles/_main/paddle_ocr/main.py", line 14 in main
File "/private/var/tmp/_bazel_lev1ty/3b8fb8eaf07df7eb5946fd70f125660d/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/paddle_ocr/paddle_ocr.runfiles/rules_python~~pip~pip_311_absl_py/site-packages/absl/app.py", line 254 in _run_main
File "/private/var/tmp/_bazel_lev1ty/3b8fb8eaf07df7eb5946fd70f125660d/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/paddle_ocr/paddle_ocr.runfiles/rules_python~~pip~pip_311_absl_py/site-packages/absl/app.py", line 308 in run
File "/private/var/tmp/_bazel_lev1ty/3b8fb8eaf07df7eb5946fd70f125660d/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/paddle_ocr/paddle_ocr.runfiles/_main/paddle_ocr/main.py", line 19 in <module>
Extension modules: numpy.core._multiarray_umath, numpy.core._multiarray_tests, numpy.linalg._umath_linalg, numpy.fft._pocketfft_internal, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator, google._upb._message, cython.cimports.libc.math, PIL._imaging, PIL._imagingft, shapely.lib, shapely._geos, shapely._geometry_helpers, pyclipper._pyclipper, skimage._shared.geometry, scipy._lib._ccallback_c, scipy.ndimage._nd_image, scipy.special._ufuncs_cxx, scipy.special._ufuncs, scipy.special._specfun, scipy.special._comb, scipy.linalg._fblas, scipy.linalg._flapack, scipy.linalg.cython_lapack, scipy.linalg._cythonized_array_utils, scipy.linalg._solve_toeplitz, scipy.linalg._flinalg, scipy.linalg._decomp_lu_cython, scipy.linalg._matfuncs_sqrtm_triu, scipy.linalg.cython_blas, scipy.linalg._matfuncs_expm, scipy.linalg._decomp_update, scipy.sparse._sparsetools, _csparsetools, scipy.sparse._csparsetools, scipy.sparse.linalg._dsolve._superlu, scipy.sparse.linalg._eigen.arpack._arpack, scipy.sparse.csgraph._tools, scipy.sparse.csgraph._shortest_path, scipy.sparse.csgraph._traversal, scipy.sparse.csgraph._min_spanning_tree, scipy.sparse.csgraph._flow, scipy.sparse.csgraph._matching, scipy.sparse.csgraph._reordering, scipy.special._ellip_harm_2, _ni_label, scipy.ndimage._ni_label, skimage.measure._ccomp, _skeletonize_3d_cy, skimage.morphology._skeletonize_3d_cy, skimage.morphology._skeletonize_cy, scipy.spatial._ckdtree, scipy._lib.messagestream, scipy.spatial._qhull, scipy.spatial._voronoi, scipy.spatial._distance_wrap, scipy.spatial._hausdorff, scipy.spatial.transform._rotation, skimage.measure._pnpoly, skimage.morphology._convex_hull, skimage.morphology._grayreconstruct, skimage.morphology._extrema_cy, skimage.morphology._flood_fill_cy, skimage.morphology._max_tree, scipy.optimize._minpack2, scipy.optimize._group_columns, scipy.optimize._trlib._trlib, scipy.optimize._lbfgsb, _moduleTNC, scipy.optimize._moduleTNC, scipy.optimize._cobyla, scipy.optimize._slsqp, scipy.optimize._minpack, scipy.optimize._lsq.givens_elimination, scipy.optimize._zeros, scipy.optimize._highs.cython.src._highs_wrapper, scipy.optimize._highs._highs_wrapper, scipy.optimize._highs.cython.src._highs_constants, scipy.optimize._highs._highs_constants, scipy.linalg._interpolative, scipy.optimize._bglu_dense, scipy.optimize._lsap, scipy.optimize._direct, scipy.integrate._odepack, scipy.integrate._quadpack, scipy.integrate._vode, scipy.integrate._dop, scipy.integrate._lsoda, scipy.special.cython_special, scipy.stats._stats, scipy.stats.beta_ufunc, scipy.stats._boost.beta_ufunc, scipy.stats.binom_ufunc, scipy.stats._boost.binom_ufunc, scipy.stats.nbinom_ufunc, scipy.stats._boost.nbinom_ufunc, scipy.stats.hypergeom_ufunc, scipy.stats._boost.hypergeom_ufunc, scipy.stats.ncf_ufunc, scipy.stats._boost.ncf_ufunc, scipy.stats.ncx2_ufunc, scipy.stats._boost.ncx2_ufunc, scipy.stats.nct_ufunc, scipy.stats._boost.nct_ufunc, scipy.stats.skewnorm_ufunc, scipy.stats._boost.skewnorm_ufunc, scipy.stats.invgauss_ufunc, scipy.stats._boost.invgauss_ufunc, scipy.interpolate._fitpack, scipy.interpolate.dfitpack, scipy.interpolate._bspl, scipy.interpolate._ppoly, scipy.interpolate.interpnd, scipy.interpolate._rbfinterp_pythran, scipy.interpolate._rgi_cython, scipy.stats._biasedurn, scipy.stats._levy_stable.levyst, scipy.stats._stats_pythran, scipy._lib._uarray._uarray, scipy.stats._ansari_swilk_statistics, scipy.stats._sobol, scipy.stats._qmc_cy, scipy.stats._mvn, scipy.stats._rcont.rcont, scipy.stats._unuran.unuran_wrapper, skimage.segmentation._felzenszwalb_cy, scipy.cluster._vq, scipy.cluster._hierarchy, scipy.cluster._optimal_leaf_ordering, skimage.segmentation._slic, skimage.segmentation._quickshift_cy, skimage.segmentation._watershed_cy, scipy.io.matlab._mio_utils, scipy.io.matlab._streams, scipy.io.matlab._mio5_utils, lmdb.cpython, charset_normalizer.md (total: 144)
Error: bazel exited with exit code: -1
~/Projects/xat> /private/var/tmp/_bazel_lev1ty/3b8fb8eaf07df7eb5946fd70f125660d/external/rules_python~~python~python_3_11_7_aarch64-apple-darwin/lib/python3.11/multiprocessing/resource_tracker.py:254: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
warnings.warn('resource_tracker: There appear to be %d |
@jzhang533 - I also noticed that it is not running on Google Colab. Version: My code: Error: Timestamp Level Message |
Here's a full lldb backtrace from an M1 Pro, Python 3.11.
Paddle version:
Inference command:
|
I suspect this is related to blas library paddlepaddle is using on mac. Probably we can upgrade openblas to the latest version, and see what will happen. Another better option is using Apple's proprietary BLAS implementation, it should be much more faster than using openblas, since Apple's implementation is using accelerator on M1. But this requires lots of work. |
I'd like to subscribe to this issue too :) Apple M2 on MBA 15". It just hangs.
|
Same here:
|
Also experiencing this on M1 Pro |
if you are still suffering from this issue, please uninstall your local paddlepaddle, and try nightly build:
I figured out how to use Apple's BLAS library to replace openblas on a boring meeting, and created this PR: PaddlePaddle/Paddle#64408 . |
good job, it works, any update now? |
If the problem still exists, maybe you could refer this link |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Running this command on teminal just stuck your teminal and you cannot even stop it using "control + c" or "cmd + c" only "control + z" works to stop process:
$
paddleocr --image_dir ./imgs/rec-image.jpg --use_angle_cls true --use_gpu false
device: Apple M3 Pro - Macbook
python version: 3.12.1
paddleocr==2.6.0.1
paddlepaddle==2.6.0
PyMuPDF==1.23.26
请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem
请尽量不要包含图片在问题中/Please try to not include the image in the issue.
The text was updated successfully, but these errors were encountered: