Search code examples
pythonaws-lambdascipyaws-amplify

SciPy being installed automatically


So I have the following code:

import os
import io
import boto3
import json
import sagemaker
from PIL import Image
import numpy as np
import io
from sagemaker.amazon.record_pb2 import Record
import mxnet as mx
import base64

def handler(event, context):

The following Pipfile

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
boto3="*"
sagemaker="*"
image="*"

[requires]
python_version = "3.8"

Now I'm trying to deploy this on AWS Lambda - the problem I'm having is somehow SciPy is ending up in the install bundle when I haven't installed it - I thought Numpy and SciPy were two different packages and can't figure out where it's coming from?

enter image description here


Solution

  • Cos it's requirement in sagemaker see setup.py

    # See setup.py from line 35 
    # Declare minimal set for installation
    required_packages = [
        "boto3>=1.13.6",
        "numpy>=1.9.0",
        "protobuf>=3.1",
        "scipy>=0.19.0",
        "protobuf3-to-dict>=0.1.5",
        "smdebug-rulesconfig==0.1.4",
        "importlib-metadata>=1.4.0",
        "packaging>=20.0",
    ]