Klayers
Klayers copied to clipboard
[BUG] PyTesseract Doesn't work with libpng15
Describe the bug I've been using the pytesseract lambda image on top of aws-lambda-tesseract-layer. It does not work and I'm hoping to get clarification in the docs.
Screenshots When running my function I see this error
{
"errorMessage": "(127, 'tesseract: error while loading shared libraries: libpng15.so.15: cannot open shared object file: No such file or directory')",
"errorType": "TesseractError",
"stackTrace": [
" File \"/var/task/handler.py\", line 22, in translate\n text = image_to_text(file_name)\n",
]
}
It seems to imply that imports all succeeded and the tesseract binary is working. It breaks down when trying to run pytesseract though.
Layer Version ARN:
arn:aws:lambda:us-west-1:<my account>:layer:tesseract:7
(my own, following the tutorial in the README)
arn:aws:lambda:us-west-1:770693421928:layer:Klayers-python38-pytesseract:14
Framework: Serverless
Additional context It would be nice (and I'd be happy to help) to build a standard tesseract layer that plays nicely with the pytesseract layer.
Oh and I did go through https://github.com/keithrozario/Klayers/issues/94 and comment there. At this point, I think this issue is distinct.
So I've got this working now. It was an issue with the Tesseract base image actually (see https://github.com/bweigel/aws-lambda-tesseract-layer/pull/14).
Since everything else moved to Python 3.8, perhaps we can work together on getting a base image with the tesseract binary working in this repo?
I'm happy to include in the repo, if someone has a working binary layer already :)...
I do have one working! My fork is working for Python 3.8. You just need to clone it and run:
# Build Layer components
./build.sh
# Deploy via Serverless
sls deploy
I don't have mine available in every availability zone like you do, so I think it'd be best if you still owned the layer though. What do you think?
Is there a Tesseract layer available for region sa-east-1? It could be python 3.8 or python 3.9... Thanks