Reputation: 47
I have been working on a python script to get text from photos using PaddleOCR. Obviously everything works as expected on Windows x64. I managed to install paddleocr successfully on my MacBook Pro M1 by manually compiling a few dependencies like MuPdf and lanms-neo however, the script hangs forever on paddleocr trying to process the image, cpu at 100% but nothing happens. I have tested the example above on my windows machine and It runs immediately. Does anybody had a similar experience and know how to make it work on my M1?
from paddleocr import PaddleOCR
ocr = PaddleOCR(lang='en')
lines = ocr.ocr('<path to image>')
text = ''
for string in lines:
text += " " + string[1][0].replace(' ', '')
I have tried different python versions, 3.9.6 is the only one working with paddleOCR on M1. The installation of paddleocr package by pip3 wasn't straightforward. I had to manually compile the wheels of MuPdf 1.19, lanms-neo and freetype2 before installing their python packages as they were failing on getting some headers even with the python-dev installed. The installation succeeded, no errors and no dependencies missing. the package PaddlePaddle installed without issues with pip3.
Upvotes: 5
Views: 2172
Reputation: 518
The issue could very possibly be related to the blas library paddlepaddle is using on mac, see here for further details in this link. Try to install it like this:
python -m pip install paddlepaddle==0.0.0 -f https://www.paddlepaddle.org.cn/whl/mac/cpu/develop.html
Upvotes: 0
Reputation: 722
pip install https://github.com/pymupdf/PyMuPDF/archive/master.tar.gz
source of answer please check here
Upvotes: 1
Reputation: 324
I've got an M1 Mac, got it working last week with these versions:
pip install paddlepaddle==2.3.2
pip install paddleocr==2.6.1.0
pip install opencv-python==4.5.5.64
Upvotes: 1