Is there a way to install numpy
on a Mac so that it will work when uploaded to AWS Lambda? I have tried a variety of different ways, including using different pip
versions, using easy_install
, and following this post, but none of them seem to work. I also tried cloning the git repo and building from there, but I also wasn't able to get that to work (though I'm not sure if I copied the right files up after doing that)
The error I'm getting is:
Unable to import module 'lambda_function': Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy. If you're working with a numpy git repo, try
git clean -xdf
(removes all files not under version control). Otherwise reinstall numpy.
Inspired by this post, I was able to pip install
numpy
in a Linux environment and get it to work on Lambda.
So my question is: Is it possible to install numpy
on a Mac so that it works on AWS Lambda?
Environment: MacBook Pro, MacOS 10.12.2, default python version 2.7.10
I've been testing it with a minor variation on the hello-world-python
example on Lambda:
from __future__ import print_function
import numpy
def lambda_handler(event, context):
#print("Received event: " + json.dumps(event, indent=2))
print("value1 = " + event['key1'])
(Update) Extending the question: Why do some packages work and others don't?
numpy
and not for other packages?numpy
is the only one where I've been running into this issue (so far). Asked another way - is there a way to know ahead of time which packages will require a Linux build? – Tchotchke