I have the following error when i run my AWS lambda under python 3.9 :
[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /var/task/cryptography/hazmat/bindings/_rust.abi3.so)
Traceback (most recent call last):
I am aware that this is somehow a compilation issue so here the steps i have done until the AWS lambda deployment :
- Create a Dockerfile :
# syntax=docker/dockerfile:1
FROM ubuntu:latest
ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update -y
RUN apt-get install software-properties-common -y
RUN add-apt-repository ppa:deadsnakes/ppa
# Install py39 from deadsnakes repository
RUN apt-get install python3.9 -y
# Install pip from standard ubuntu packages
RUN apt-get install python3-pip -y
RUN apt-get install zip -y
RUN apt-get install libc6 -y
RUN mkdir /home/packages
RUN pip install --target=/home/packages pyjwt[crypto]==2.6.0
RUN pip install --target=/home/packages pymongo[srv]==4.3.3
- Inside the docker container, i do :
cd /home/packages - Then :
zip -r ../package.zip . - Then i use
docker cpto copy thepackage.zipto my MacOS host.
I use zip -g package.zip lambda_function.py and i upload the .zip file using boto3.
I would like to know why this is not enough or what am i missing here ?
Note : i need to keep using the zip method to upload the lambda package for other reasons, unless there is no other choice of course..
Thanks a lot in advance
from Python AWS Lambda in error because of pyjwt[crypto] (cryptography)

No comments:
Post a Comment