I have been trying to import python module "Pulp" to the Amazon AWS Lambda but getting an error. Pulp is an optimization module which can be installed using pip ("pip install pulp") but as in AWS Lambda I'm not sure how to install it so I zipped everything along with Lambda Function from my local machine and uploaded it to AWS Lambda.
The error which I received:-
"Attempted relative import in non-package: ValueError
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 5, in lambda_handler
import pulp
File "/var/task/pulp.py", line 101, in
from .constants import *
ValueError: Attempted relative import in non-package"
Thanks in advance.
解决方案
On how to deploy to AWS lambda using virtualenv.