Pandas & AWS Lambda

前端 未结 11 887
太阳男子
太阳男子 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:22

    # all the step are done in AWS EC2 Linux Free tier so that all the Libraries  are compatible with the Lambda environment
    
    # install the required packages
    mkdir packages
    pip3 install -t . pandas
    pip3 install -t . numpy --upgrade
    pip3 install -t . wikipedia --upgrade
    pip3 install -t . sklearn --upgrade
    pip3 install -t . pickle-mixin --upgrade
    pip3 install -t . fuzzywuzzy --upgrade
    
    
    # Now remove all unnecessary files
    sudo rm -r *.whl *.dist-info __pycache__
    
    # Now make a DIR so that lambda function can reconginzes
    sudo mkdir -p build/python/lib/python3.6/site-packages
    
    
    # Now move all the files from packages folder to site-packages folder 
    sudo mv /home/ec2-user/packages/*  build/python/lib/python3.6/site-packages/
    
    # Now move to the build packages
    cd build
    
    # Now zip all the files starting from python folder to site-packages
    sudo zip -r python.zip .
    

    upload the zip file to lambda layers

提交回复
热议问题