3

I'm trying to upload a deployment package to my AWS lambda function following the article https://korniichuk.medium.com/lambda-with-pandas-fd81aa2ff25e. My final zip file is as follows: https://drive.google.com/file/d/1NLjvf_-Ks50E8z53DJezHtx7-ZRmwwBM/view but when I run my lambda function I get the error Unable to import module 'lambda_function': No module named 'importlib_metadata' errorimg

My handler is named lambda_function.lambda_handler which is the file name and the function to run. I also tried uploading these zip files as layers excluding the lambda_function.py and get: layerErr What am I doing wrong?

EDIT: I tried using zip/lambda_function.lambda_handler as my handler still getting Unable to import module 'zip/lambda_function': No module named 'zip/lambda_function'

2
  • Why not use pre-existing pandas layer? Commented Apr 27, 2021 at 7:55
  • @Marcin How do I use pre-existing pandas layer? You mean clone some git repository? Or it is provided by aws lambda? Commented Apr 27, 2021 at 7:57

1 Answer 1

2

There is a third party github repo with public layers, including pandas. You don't have to do anything to use, except adding the layer arn to your function. The arn depends on your region, so you have to choose your region. For example, for us-east-1 the pandas layer for python 3.8 is:

arn:aws:lambda:us-east-1:770693421928:layer:Klayers-python38-pandas:31
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you so much. This solution saves a lot of time and really easy to implement.
@eras'q No problem. Glad it helped.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.