简体   繁体   English

AWS Python lambda:pip install requirements.txt with --no-deps

[英]AWS Python lambda: pip install requirements.txt with --no-deps

Using AWS CDK v2, I want to deploy two lambda functions .使用 AWS CDK v2,我想部署两个lambda 函数 As both depend on pandas , I want to deploy a layer first, which has pandas and its dependencies in requirements.txt located at entry .由于两者都依赖于pandas ,我想先部署一个,该层具有pandas及其在位于entryrequirements.txt中的依赖项。

One of the lambda functions also depends on pyarrow , which I put into the requirements.txt located at entry of that lambda function. lambda 函数之一也依赖于pyarrow ,我将其放入位于 lambda function entryrequirements.txt中。 As both pyarrow and pandas depend numpy , I currently end up with numpy and its dependencies being installed both in the layer and that lambda function, which obviously isn't what I want. As both pyarrow and pandas depend numpy , I currently end up with numpy and its dependencies being installed both in the layer and that lambda function, which obviously isn't what I want.

In the end, I'm looking for a way to pass --no-deps to the pip installation of requirements.txt of the lambda function that depends on pyarrow .最后,我正在寻找一种将--no-deps传递给pip安装的 lambda functionrequirements.txt的方法,这取决于。 Any ideas how to achieve this?任何想法如何实现这一目标?

I don't think this is possible to specify no-deps when using a requirements.txt.我认为在使用 requirements.txt 时无法指定no-deps CDK also can use pipenv 's Pipfile and Poetry 's poetry.lock . CDK 也可以使用pipenvPipfilePoetrypoetry.lock That being said, in my research none of those tools seem to support installing with --no-deps either unless you manually mess with the lock files (not advised or maintainable really).话虽如此,在我的研究中,这些工具似乎都不支持使用--no-deps进行安装,除非您手动弄乱了锁定文件(实际上不建议或可维护)。

Looking deeper at the specific problem, I don't see pyarrow listing pandas as a dependency but I do see it installing numpy which is a dependency of pandas深入研究具体问题,我没有看到pyarrowpandas列为依赖项,但我确实看到它安装numpy这是pandas的依赖项

I think your best option presently is to just deal with having numpy in both places or put both pyarrow and pandas in the layer.我认为你目前最好的选择是只处理在两个地方都有numpy或将pyarrowpandas放在层中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM