Issue with Importing fitz (PyMuPDF) in AWS Lambda #4280
-
Hi everyone, I'm trying to use fitz (PyMuPDF) in an AWS Lambda function, but I keep running into the following error:
I've tried adding pymupdf to a Lambda layer, but it seems to cause issues due to its dependencies being binary-based. I saw that in the past, people used AWS CodeCommit to resolve this, but now it appears that creating a new CodeCommit repository is no longer possible. Does anyone know the best way to get fitz running inside AWS Lambda Any help or guidance would be greatly appreciated! Thanks in advance. 🚀 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Do you tried use docker? You need to create an environment that supports binary dependencies. Create a dockerfile
Build
Generate ZIP
Upload zip
|
Beta Was this translation helpful? Give feedback.
-
This might be a duplicate of #430. |
Beta Was this translation helpful? Give feedback.
Do you tried use docker? You need to create an environment that supports binary dependencies.
Create a dockerfile
Build
docker build -t pymupdf-layer .
Generate ZIP
docker run --rm -v $(pwd):/out pymupdf-layer bash -c "cd /lambda && zip -r /out/pymupdf-layer.zip python"
Upload zip
aws lambda publish-layer-version \ --layer-name pymupdf-layer \ --description "AWS Lambda layer for PyMuPDF (fitz)" \ --zip-file fileb://pymupdf-layer.zip \ --co…