MattWillFlood / EntropyHub

An open-source toolkit for entropic data analysis.
https://www.entropyhub.xyz
Apache License 2.0
146 stars 19 forks source link

Using EntropyHub on AWS Lambda Functions #14

Open felipemadeiros opened 2 months ago

felipemadeiros commented 2 months ago

Hi.

I don't know if the right place to write this, but it a help for someone is working with AWS Lambda Function and is facing problem on to import the EntropyHub.

EntropyHub is not available by default on the AWS Lambda Function then you need to create a Layer with the lib and add to the Lambda Function.

The process to is simple and easy, as describe above

$ mkdir python
$ pip install EntropyHub -t ./python
$ zip -r python_libs.zip python

Upload the zip file on the Layer and the lib will be available on the Lambda Fuction

But I faced with a "strange" problem when try to import the module on the Lambda Function

[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': Error importing numpy: you should not try to import numpy from its source directory; please exit the numpy source tree, and relaunch your python interpreter from there.
Traceback (most recent call last):

That happened because I am using MAC OS with ARM processor and the Lambda Funcion runs Linux OS and X86 processor (you can configure the Lambda to runs on ARM too)

After change de Lambda Function to run on ARM processor and do the process to download the EntropyHub lib on a container image with Linux, everything works fine.

I hope that's can help someone.