Jackery Xu
Jackery Xu

Reputation: 402

AWS Lambda cannot find module Python

AWS lambda is able to find my function in handler settings and certain libraries I have installed in the root folder, but is unable to find other libraries like pyodbc and google.cloud.storage.

Error: START RequestId: 607f59cb-44a9-11e7-82c2-813a7578fcd0 Version: $LATEST Unable to import module 'push_to_s3': No module named pyodbc

Upvotes: 1

Views: 1636

Answers (1)

joarleymoraes
joarleymoraes

Reputation: 1949

You might need to pre-compile the pyodbc lib using the specific AMI Lambda uses (AMI name: amzn-ami-hvm-2016.03.3.x86_64-gp2).

Here the install instructions on Linux:

https://learn.microsoft.com/en-us/sql/connect/python/pyodbc/step-1-configure-development-environment-for-pyodbc-python-development

Here are more details about native libraries on Lambda env.:

http://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html

Here some other things you might consider while creating your deployment packages:

http://joarleymoraes.com/hassle-free-python-lambda-deployment/

Upvotes: 1

Related Questions