3

This is my First ever post here

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.

MarcoT
  • 31
  • 2

2 Answers2

1

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
int21h
  • 189
  • 3
  • 8
  • It worked. I uninstalled the previous version and installed these new ones. In my case I didn't have to specify a specific version for opencv though. – Hissaan Ali Apr 02 '23 at 11:48
1
pip install https://github.com/pymupdf/PyMuPDF/archive/master.tar.gz

source of answer please check here

Chandan Gupta
  • 684
  • 4
  • 11