I am working on an OCR using Tesseract. When I work local it works fine, but I can't make it work when I deploy to Google App Engine.
This is the line where the code breaks in the deploy:
d = pytesseract.image_to_data(img, output_type=Output.DICT)
I get this error from the gcloud app logs tail -s
File "/app/pol_flow.py", line 1587, in upload_ocr d = pytesseract.image_to_data(img, output_type=Output.DICT) File "/usr/local/lib/python3.6/site-packages/pytesseract/pytesseract.py", line 409, in image_to_data if get_tesseract_version() < '3.05':
File "/usr/local/lib/python3.6/site-packages/pytesseract/pytesseract.py", line 118, in wrapper wrapper._result = func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pytesseract/pytesseract.py", line 327, in get_tesseract_version raise TesseractNotFoundError() pytesseract.pytesseract.TesseractNotFoundError: /app is not installed or it's not in your pathTesseractNotFoundError() pytesseract.pytesseract.TesseractNotFoundError: /app is not installed> or it's not in your path
I know that I have to pass the location into the code like this:
pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
But I don't know the path where Tesseract is installed when I make the deploy.
Thanks for your help!
PS: I followed this answer but when I make the request to the deployed endpoint in App Engine I still get the same error: TesseractNotFoundError()