问题
I have imported several packages into my AWS Lambda python code
. I have scipy
installed and seems to be imported correctly using import scipy
.However, when I try to import the submodules like from scipy.signal import lfilter
, I am unable to import those kind of modules in the Lambda
function. I have no clue on why the package import works locally
and not on Lambda
Here is a my worker.py
import logging
def lambda_handler(event, context):
bucket = event['Records'][0]['s3']['bucket']['name']
key = urllib.unquote_plus(event['Records'][0]['s3']['object']['key']).decode('utf8')
runFunction(bucket, key)
try:
response = s3.get_object(Bucket=bucket, Key=key)
print("CONTENT TYPE: " + response['ContentType'])
return response['ContentType']
except Exception as e:
print(e)
Here is my handler.py
import sys
try:
import numpy as np
print(1)
import pandas as pd
print(2)
from scipy.signal import lfilter
print(3)
from uts import io, utils
except Exception, err:
print Exception, err
runFunction(bucket, key)
In this code, I am not able to import from scipy.signal import lfilter
. Printing 1 and 2 is fine but the third print statement doesn't work and throws exception.
Here is the exception.
libblas.so.3: cannot open shared object file: No such file or directory
来源:https://stackoverflow.com/questions/35020051/unable-to-import-submodules-of-scipy-in-aws-lambda