4

How do I correctly exclude certainly libraries (like torch, numpy...) from zappa package? I tried setting the exclude parameter in zappa_settings.json but it doesn't seem like excluding these packages.

Below is my zappa_settings.json

{
    "dev": {
        "app_function": "predict.app",
        "aws_region": "us-east-1",
        "profile_name": "default",
        "project_name": "check-api",
        "runtime": "python3.6",
        "s3_bucket": "zappa-12345",
        "keep_warm": false,
        "exclude": ["boto3*", "botocore*", "tqdm*", "numpy*", "torch*"]
    }
}

I'm trying to exclude torch & numpy as these are resulting in "No space left error". I would rather use a Lambda layer (& install in /opt directory in Lambda) rather than the /tmp directory

jon
  • 429
  • 6
  • 15
  • How did you verify what's included? With `zappa package [stage_env]` and inspecting the archive? – tmt Nov 11 '19 at 13:07
  • I checked the zip file that was getting created and uploaded to the S3 bucket – jon Nov 11 '19 at 14:48

1 Answers1

1

exclude setting is not working as expected in zappa settings as described here:

https://github.com/Miserlou/Zappa/issues/692

The current behaviour of exclude is destructive, because it applies to all files regardless of depth.

You can try the exclude without wildcard: "exclude": ["boto3", "botocore", "tqdm", "numpy", "torch"] But be aware that this will also delete files with the same name in subdirectories.

Rene B.
  • 6,557
  • 7
  • 46
  • 72