[英]Deploying to AWS lambda hits size limit and packages (such as numpy) are not compatible
I have a relatively small script where I use the following dependencies: 我有一个相对较小的脚本,在其中使用以下依赖项:
firebase-admin
pandas
Nevertheless, when you install these dependencies you get over 60 additional dependencies installed as well, such as numpy
, scikit
, google_cloud
etc. 不过,当您安装这些依赖项时,还会安装60多个其他依赖项,例如
numpy
, scikit
, google_cloud
等。
I encountered many problems during deployment, of which the following were the most striking: 在部署过程中,我遇到了许多问题,其中最引人注目的是:
numpy
, so you need to unwheel them (see link ). numpy
,因此您需要展开它们(请参阅link )。 I have spent now maybe two days trying to get around these problems. 我现在可能已经花了两天时间来解决这些问题。 However, I did not manage to succeed to run my small script at all.
但是,我根本没有成功运行小脚本。
I am therefore wondering: 因此,我想知道:
Note on the latter: I have tried also the following solutions: 关于后者的说明:我也尝试了以下解决方案:
lambda init
after installation. lambda init
。 See my question on that issue here . README.me
after installing aws-sam-cli
and followed all the steps. aws-sam-cli
之后,我遵循了README.me
并遵循了所有步骤。 This resulted that I uploaded a new package on S3, which I used to create a new layer. numpy
in my requirements.txt and properly build the site packages (as it was in my SamApp visible). numpy
放入我的requirements.txt中并正确构建了站点包(因为它在我的SamApp中可见),但我仍然收到错误“找不到numpy”。 You can deploy to lambda & surrounding services using serverless framework. 您可以使用无服务器框架部署到lambda和周围的服务。 I use serverless framework with the serverless-python-requirements plugin which will compile and bundle any needed python requirements.
我将无服务器框架与无服务器python需求插件一起使用,该插件将编译并捆绑任何所需的python要求。 Under the hood it translates into a cloudformation template and deploys your function(s) and dependent resources as a stack into AWS.
它在后台转换为cloudformation模板,并将您的功能和相关资源作为堆栈部署到AWS中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.