Pandas & AWS Lambda

前端 未结 11 903
太阳男子
太阳男子 2020-12-03 04:52

Does anyone have a fully compiled version of pandas that is compatible with AWS Lambda?

After searching around for a few hours, I cannot seem to find what I\'m looki

11条回答
  •  盖世英雄少女心
    2020-12-03 05:15

    My solution has been to maintain 2 requirements.txt style files of packages that go in my layer, one named provided_packages.txt and one named provided_linux_installs.txt

    Before deployment (if the packages are not already installed) I run:

    pip install -r provided_packages.txt -t layer_name/python/lib/python3.8/site-packages/.
    pip download -r provided_linux_installs.txt --platform manylinux1_x86_64 --no-deps -d layer_name/python/lib/python3.8/site-packages
    
    cd layer_name/python/lib/python3.8/site-packages 
    unzip \*.whl
    rm *.whl
    

    Then deploy normally (I am using cdk synth & cdk deploy \* --profile profile_name)

    In case helpful, my provided_linux_installs.txt looks like this:

    pandas==1.1.0
    numpy==1.19.1
    pytz==2020.1
    python-dateutil==2.8.1
    

提交回复
热议问题