1
votes

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

1
Is there a pyodbc packaged with your Labda? Can you show us an overview of the Lambda packaging? - stdunbar
@stdunbar yes, i just ran 'pip install pyodbc -t .' in the folder I zipped and it added both the pyodbc.pyd file and the pyodbc-4.0.16.dist-info folder - Jackery Xu
stackoverflow.com/a/64327675/2506172 should be relevant here. - narayan

1 Answers

1
votes

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://docs.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/