Pandas & AWS Lambda

前端 未结 11 904
太阳男子
太阳男子 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-03 05:23

    @ashtonium's answer actually works and is most likely the easiest, however, a few additional steps are required. Also, Pandas requires Pytz (mentioned in the link provided by @b3rt0) so that package is needed as well.

    1. Download the whl-files from PyPI (the Pandas file ends with ...manylinux1_x86_64.whl, there is only one Pytz file of relevance)
    2. Unzip the whl-files using terminal command, e.g. unzip filename.whl (Linux/MacOS)
    3. Create a new folder structure python/lib/python3.7/site-packages/ (swap 3.7 for version of your choice)
    4. Move folders from step 2 to site-packages folder in step 3
    5. Zip root folder in new structure, i.e. python
    6. Create a new layer in AWS management console where you upload the zip-file

    This is a very common question, I hope my solution helps.

    Update on Aug 19, 2020: Wheel-files aren't available for all packages. In these cases you can skip to step 3, go into the site-packages folder and install the package in there with pip3 install PACKAGE_NAME -t . (no venv required). Some packages are easier than others, some are trickier. Psycopg2 for example, requires you to move only one of the two (as of this writing) package folders.

    /Cheers

提交回复
热议问题