Sean McCarthy
Sean McCarthy

Reputation: 5588

Does Amazon Web Services (AWS) Lambda support all Python libraries?

For example, I would like to use scikit-learn for machine learning, and pandas, numpy, and matplotlib/seaborn for data analysis. Does AWS Lambda support all these libraries? Is there a list of libraries supported? Or should I create a virtual server instead, to ensure I can use any Python library I want?

Upvotes: 6

Views: 17042

Answers (3)

ft9
ft9

Reputation: 301

In addition to the default Python Standard Library, some third-party packages are embedded in AWS Lambda Python runtimes. These packages are ready to be used in your FaaS functions.

  • Python 3.8.1
  • boto3 1.10.34
  • botocore 1.13.34
  • docutils 0.15.2
  • jmespath 0.9.4
  • pip 19.2.3
  • python-dateutil 2.8.0
  • rapid-client 0.0.0
  • s3transfer 0.2.1
  • setuptools 41.2.0
  • six 1.13.0
  • urllib3 1.25.7

A daily-updated list of supported packages can be found here.
https://www.feitsui.com/en/article/2

Upvotes: 5

Rob Bricheno
Rob Bricheno

Reputation: 4653

Those modules are not available by default. I found this (older) list of available modules, along with code to generate a current report of what is available, should you wish to do so:

https://gist.github.com/sjehutch/36493ff674b1b9a16fc44a5fc270760c

You can build your own environment using a virtualenv and upload that to Lambda. It can contain anything you want. See here for more info:

https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html

So you can still use AWS Lambda, and should not require a virtual server.

Edited to add a bit of self promotion:

I made a web site that shows the current modules available in each environment provided by Amazon.

Upvotes: 21

Pedro
Pedro

Reputation: 172

I've built a small library called juniper to automate the packaging of code for AWS lambda functions.

All you need to do to use juniper is create a small manifest.yml file that looks like:

functions:
  # Name the zip file you want juni to create
  router:
    # Where are your dependencies located?
    requirements: ./src/requirements.txt.
    # Your source code.
    include:
    - ./src/lambda_function.py

As long as you have your dependencies in the requirements.txt, juniper will package them for you. There are a few examples in our code base that showcase the features of juniper.

Upvotes: 1

Related Questions