4

How to deploy to python function which has the dependency on external libraries?
For example, I am trying to deploy to a data-analysis python function. When I try to test the python function from the lambda console, I get:
Unable to import module 'lambda_function': No module named pandas

I am totally new to Aws Lambda

Is there a linux box on which Lambda functions run where I can install these libraries?

2
  • 1
    Have you tried to install pandas using pip install pandas ? It seems that pandas package/module isn't installed in your box. Commented May 26, 2017 at 19:30
  • @ChihebNexus What do you mean by my box? Sorry but I do not know where lambda functions run. Commented May 26, 2017 at 19:36

2 Answers 2

6

You need to create a deployment package as detailed here: http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html#deployment-pkg-for-virtualenv

This just means bundling the contents of site-packages for the environment you're developing on into the deployment package together with the lambda python script into a zip that is uploaded.

Sign up to request clarification or add additional context in comments.

Comments

3

If you new to Lambda deployment, you might want check this tutorial (I wrote), which covers the most common pitfalls. And gives you a script as well to automate the entire process.

1 Comment

Not accessible anymore

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.