Skip to content

How to upload pandas, sqlalchemy package in lambda to avoid error “Unable to import module ‘lambda_function’: No module named ‘importlib_metadata'”?

I’m trying to upload a deployment package to my AWS lambda function following the article My final zip file is as follows: 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 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'



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:

User contributions licensed under: CC BY-SA
9 People found this is helpful