[英]AWS Python lambda: pip install requirements.txt with --no-deps
使用 AWS CDK v2,我想部署兩個lambda 函數。 由於兩者都依賴於pandas ,我想先部署一個層,該層具有pandas及其在位於entry
的requirements.txt
中的依賴項。
lambda 函數之一也依賴於pyarrow ,我將其放入位於 lambda function entry
的requirements.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.
最后,我正在尋找一種將--no-deps
傳遞給pip
安裝的 lambda function的requirements.txt
的方法,這取決於。 任何想法如何實現這一目標?
我認為在使用 requirements.txt 時無法指定no-deps
。 CDK 也可以使用pipenv
的Pipfile
和Poetry的poetry.lock
。 話雖如此,在我的研究中,這些工具似乎都不支持使用--no-deps
進行安裝,除非您手動弄亂了鎖定文件(實際上不建議或可維護)。
深入研究具體問題,我沒有看到pyarrow
將pandas
列為依賴項,但我確實看到它安裝numpy
這是pandas
的依賴項
我認為你目前最好的選擇是只處理在兩個地方都有numpy
或將pyarrow
和pandas
放在層中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.