I'm working on a lambda function that partly depends on numpy. I created a deployment package zip with a test script that imports numpy and then tries to subtract two numbers using np.subtract since it was having trouble finding the numpy functions.
import numpy as np
a = np.subtract(4,2)
print(a)
I'm working with a python3.5 virtualenv on a linux EC2 instance. To create the deployment zip, I installed numpy, placed my script into site-packages and zipped the contents of the folder as described here. I can create the lambda function from the zip file with no problem, but when I trigger it, it gives the error:
module initialization error: module 'numpy' has no attribute 'subtract'
It appears to import numpy, but it can't find any of the functions. I assume I packaged the libraries/script wrong, but I thought I was following the directions correctly. Any help would be appreciated!