Lambda function throws error version `ZLIB_1.2.9' not found

0

I created a lambda function using python 3.8 and installed pillow for image processing. By default aws installs the pillow version 9.5.0 and zlib version 1.2.11. However when I execute the function, it throws the error: version `ZLIB_1.2.9’ not found (required by Pillow.lib/libpng16.so) I have tried many things from the internet but cannot overcome this error. Could you please help me? Thank you.

已提問 1 年前檢視次數 807 次
3 個答案
0
已接受的答案

After experimentation, I managed to find a solution by myself. Instead of using the latest Amazon Linux 2023 AMI, I used the Amazon Linux 2 AMI and worked fine for my case.

已回答 1 年前
0

Hello,

Lambda function doesn't come prepacked with Pillow. The error `ZLIB_1.2.9' not found can be due to any other missing module such as opencv. Can you share your import statements which you are using in your code so I can test it on my own function.

已回答 1 年前
  • Hello, I know that lambda function doesn't come prepacked with Pillow. That is why I have created a zip file with all the necessary packages for my application. The problem is when I execute the function and it throws the error. Thank you

0

I fixed it by creating a Layer with the Pillow package. First run the following from my terminal:

pip install pillow --platform manylinux1_x86_64 --only-binary=:all: -t ./python

Then I zipped it and uploaded it as Layer.

Works with python 3.10 Architecture: x86_64

已回答 10 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南