Home > Software engineering >  Lambda Won't Detect The Layer
Lambda Won't Detect The Layer

Time:09-17

I have a python3.8, and I created a new folder and installed pandas in it using

pip3 install pandas -t .

Next thing - zipped the folder (the zipped folder is 38Mb), and uploaded to s3.

Created a Layer and added the s3 path of zip file in it (also set the runtime env to python3.8 here)

Next I created a lambda function with python3.8 and test its skeleton first and it worked.

Added the layer to the lambda function and imported pandas. And now when I run the test, it does not detect pandas and gives me Module Not Found error.

What can I be doing wrong here?

CodePudding user response:

Did you created a folder named python and put all the package files inside it? Also another supporting package Pytz is required to run panda in lambda. I use MAC OSX to create the zip file but the root folder needs to be named as "python".

The creation of the zip file is little bit lengthy to describe here, I suggest you to go through this document. Also naming convention is equally important. I think if you follow the document and create the zip file and upload it directly (or via S3) to create lambda layer then it will definitely work.

  • Related