thomasgruebl / rusty-tesseract

A Rust wrapper for Google Tesseract
MIT License
124 stars 14 forks source link

AWS Lambda Function Errors #12

Open davidjwriter opened 11 months ago

davidjwriter commented 11 months ago

I'm using rusty-tesseract with a rust lambda function and I'm getting some strange results.

When I run everything locally it works great, super easy to use!

But as soon as I deploy to an AWS Lambda, it breaks with this error:

thread 'main' panicked at 'calledResult::unwrap()on anErrvalue: CommandExitStatusError("exit status: 1", "Error in pixCreateNoInit: pixdata_malloc fail for data\nError in pixCreateTemplateNoInit: pixd not made\nError in pixCreateTemplate: pixd not made\nError in pixCopy: pixd not made\nError in pixGetDepth: pix not defined\nError in pixGetWpl: pix not defined\nError in pixGetYRes: pix not defined\nError in pixClone: pixs not defined\nPlease call SetImage before attempting recognition.\nError during processing.\n")', src/main.rs:158:74

I am deploying using Lambda Layers with pre-built Tesseract binaries. I have tried this with Tesseract v4 and v5 but get the same error each time. Here are the versions I've tried with:

The tesseract version is: "tesseract 4.1.3\n leptonica-1.82.0\n libjpeg 6b (libjpeg-turbo 2.0.90) : libpng 1.5.13 : libtiff 4.0.3 : zlib 1.2.7 : libwebp 0.3.0\n Found AVX2\n Found AVX\n Found FMA\n Found SSE\n"

And also v5:

The tesseract version is: "tesseract 5.3.2\n leptonica-1.83.1\n libjpeg 6b (libjpeg-turbo 2.0.90) : libpng 1.5.13 : libtiff 4.0.3 : zlib 1.2.7 : libwebp 0.3.0\n Found AVX2\n Found AVX\n Found FMA\n Found SSE4.1\n Found OpenMP 201511\n"

It is definitely a possible Lambda environment issue I haven't figured out yet, but I wanted to put this out there in case there is something else going on that you may want to know about.

thomasgruebl commented 11 months ago

Hi, thanks for raising this issue.

Would this tool help you?

bweigel/aws-lambda-tesseract-layer