SAM Build only completes successfully with --use-container parameter

OscarVanL picture OscarVanL · Aug 20, 2019 · Viewed 6.9k times · Source

I'm developing a Lambda function written in python3.6 to test locally, then deploy to AWS once working. I'm using PyCharm's AWS Serverless Toolkit for this.

SAM build is not building successfully when not including the --use-container parameter.

When the 'use container' checkbox is selected, I can build the function, but I don't really understand why it won't work without this checkbox.

My requirements.txt file is as follows:

sagemaker
boto3
pandas
s3fs
numpy
pathlib

With parameter:

"C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd" build --template C:\Users\------\PycharmProjects\AutomatedSageMakerTraining\template.yaml --build-dir C:\Users\------\PycharmProjects\AutomatedSageMakerTraining\.aws-sam\build --use-container AutomatedSageMakerEvaluation
2019-08-20 09:23:29 Starting Build inside a container
2019-08-20 09:23:30 Building resource 'AutomatedSageMakerEvaluation'

Fetching lambci/lambda:build-python3.6 Docker container image......
2019-08-20 09:23:32 Mounting C:\Users\------\PycharmProjects\AutomatedSageMakerTraining as /tmp/samcli/source:ro,delegated inside runtime container

Build Succeeded

Built Artifacts  : ..\..\..\..\Users\------\PycharmProjects\AutomatedSageMakerTraining\.aws-sam\build
Built Template   : ..\..\..\..\Users\------\PycharmProjects\AutomatedSageMakerTraining\.aws-sam\build\template.yaml

Commands you can use next
=========================
[*] Invoke Function: sam local invoke -t ..\..\..\..\Users\------\PycharmProjects\AutomatedSageMakerTraining\.aws-sam\build\template.yaml
[*] Package: sam package --s3-bucket <yourbucket> --template-file ..\..\..\..\Users\------\PycharmProjects\AutomatedSageMakerTraining\.aws-sam\build\template.yaml

Running PythonPipBuilder:ResolveDependencies
Running PythonPipBuilder:CopySource

Without parameter:

"C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd" build --template C:\Users\------\PycharmProjects\AutomatedSageMakerTraining\template.yaml --build-dir C:\Users\------\PycharmProjects\AutomatedSageMakerTraining\.aws-sam\build AutomatedSageMakerEvaluation
2019-08-20 09:16:30 Building resource 'AutomatedSageMakerEvaluation'
2019-08-20 09:16:30 Running PythonPipBuilder:ResolveDependencies

Build Failed
Error: PythonPipBuilder:ResolveDependencies - {bcrypt==3.1.7(wheel), protobuf3-to-dict==0.1.5(sdist), fsspec==0.4.1(sdist), dockerpty==0.4.1(sdist), pycparser==2.19(sdist), texttable==0.9.1(sdist), pyyaml==3.13(wheel), cryptography==2.7(wheel), docopt==0.6.2(sdist), s3fs==0.3.3(sdist), pynacl==1.3.0(wheel), pywin32==224(wheel), pathlib==1.0.1(sdist), sagemaker==1.37.1(sdist)}

To help debug this error, I ran the same command with the --debug parameter:

"C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd" build --template C:\Users\------\PycharmProjects\AutomatedSageMakerTraining\template.yaml --build-dir C:\Users\------\PycharmProjects\AutomatedSageMakerTraining\.aws-sam\build AutomatedSageMakerEvaluation --debug
2019-08-20 09:30:14 Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2019-08-20 09:30:14 Changing event name from before-call.apigateway to before-call.api-gateway
2019-08-20 09:30:14 Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2019-08-20 09:30:14 Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2019-08-20 09:30:14 Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2019-08-20 09:30:14 Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2019-08-20 09:30:14 Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2019-08-20 09:30:14 Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2019-08-20 09:30:14 Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2019-08-20 09:30:14 Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2019-08-20 09:30:14 Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2019-08-20 09:30:14 Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2019-08-20 09:30:14 Changing event name from before-call.apigateway to before-call.api-gateway
2019-08-20 09:30:14 Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2019-08-20 09:30:14 Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2019-08-20 09:30:14 Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2019-08-20 09:30:14 Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2019-08-20 09:30:14 Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2019-08-20 09:30:14 Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2019-08-20 09:30:14 Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2019-08-20 09:30:14 Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2019-08-20 09:30:14 Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2019-08-20 09:30:14 Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2019-08-20 09:30:14 'build' command is called
2019-08-20 09:30:14 No Parameters detected in the template
2019-08-20 09:30:14 2 resources found in the template
2019-08-20 09:30:14 Found Serverless function with name='AutomatedSageMakerTraining' and CodeUri='.'
2019-08-20 09:30:14 Found Serverless function with name='AutomatedSageMakerEvaluation' and CodeUri='.'
2019-08-20 09:30:15 Building resource 'AutomatedSageMakerEvaluation'
2019-08-20 09:30:15 Loading workflow module 'aws_lambda_builders.workflows'
2019-08-20 09:30:15 Registering workflow 'PythonPipBuilder' with capability 'Capability(language='python', dependency_manager='pip', application_framework=None)'
2019-08-20 09:30:15 Registering workflow 'NodejsNpmBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm', application_framework=None)'
2019-08-20 09:30:15 Registering workflow 'RubyBundlerBuilder' with capability 'Capability(language='ruby', dependency_manager='bundler', application_framework=None)'
2019-08-20 09:30:15 Registering workflow 'GoDepBuilder' with capability 'Capability(language='go', dependency_manager='dep', application_framework=None)'
2019-08-20 09:30:15 Registering workflow 'GoModulesBuilder' with capability 'Capability(language='go', dependency_manager='modules', application_framework=None)'
2019-08-20 09:30:15 Registering workflow 'JavaGradleWorkflow' with capability 'Capability(language='java', dependency_manager='gradle', application_framework=None)'
2019-08-20 09:30:15 Registering workflow 'JavaMavenWorkflow' with capability 'Capability(language='java', dependency_manager='maven', application_framework=None)'
2019-08-20 09:30:15 Registering workflow 'DotnetCliPackageBuilder' with capability 'Capability(language='dotnet', dependency_manager='cli-package', application_framework=None)'
2019-08-20 09:30:15 Found workflow 'PythonPipBuilder' to support capabilities 'Capability(language='python', dependency_manager='pip', application_framework=None)'
2019-08-20 09:30:15 Running workflow 'PythonPipBuilder'
2019-08-20 09:30:15 Running PythonPipBuilder:ResolveDependencies
2019-08-20 09:30:15 calling pip download -r C:\Users\------\PycharmProjects\AutomatedSageMakerTraining\requirements.txt --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z
2019-08-20 09:31:20 Full dependency closure: {sagemaker==1.37.1(sdist), docker-pycreds==0.4.0(wheel), fsspec==0.4.1(sdist), setuptools==41.1.0(wheel), botocore==1.12.211(wheel), boto3==1.9.211(wheel), websocket-client==0.56.0(wheel), paramiko==2.6.0(wheel), docker==3.7.3(wheel), protobuf3-to-dict==0.1.5(sdist), scipy==1.3.1(wheel), cryptography==2.7(wheel), jmespath==0.9.4(wheel), six==1.12.0(wheel), pynacl==1.3.0(wheel), python-dateutil==2.8.0(wheel), docutils==0.15.2(wheel), chardet==3.0.4(wheel), docopt==0.6.2(sdist), requests==2.20.1(wheel), s3transfer==0.2.1(wheel), colorama==0.4.1(wheel), cached-property==1.5.1(wheel), asn1crypto==0.24.0(wheel), dockerpty==0.4.1(sdist), protobuf==3.9.1(wheel), jsonschema==2.6.0(wheel), pytz==2019.2(wheel), pywin32==224(wheel), certifi==2019.6.16(wheel), pyyaml==3.13(wheel), numpy==1.17.0(wheel), pycparser==2.19(sdist), idna==2.7(wheel), s3fs==0.3.3(sdist), pathlib==1.0.1(sdist), texttable==0.9.1(sdist), cffi==1.12.3(wheel), pypiwin32==223(wheel), pandas==0.25.0(wheel), urllib3==1.24.3(wheel), docker-compose==1.24.1(wheel), bcrypt==3.1.7(wheel)}
2019-08-20 09:31:20 initial compatible: {docker-pycreds==0.4.0(wheel), setuptools==41.1.0(wheel), botocore==1.12.211(wheel), boto3==1.9.211(wheel), websocket-client==0.56.0(wheel), paramiko==2.6.0(wheel), docker==3.7.3(wheel), jmespath==0.9.4(wheel), six==1.12.0(wheel), python-dateutil==2.8.0(wheel), chardet==3.0.4(wheel), docutils==0.15.2(wheel), requests==2.20.1(wheel), s3transfer==0.2.1(wheel), colorama==0.4.1(wheel), cached-property==1.5.1(wheel), asn1crypto==0.24.0(wheel), jsonschema==2.6.0(wheel), pytz==2019.2(wheel), certifi==2019.6.16(wheel), idna==2.7(wheel), pypiwin32==223(wheel), urllib3==1.24.3(wheel), docker-compose==1.24.1(wheel)}
2019-08-20 09:31:20 initial incompatible: {pyyaml==3.13(wheel), numpy==1.17.0(wheel), protobuf3-to-dict==0.1.5(sdist), scipy==1.3.1(wheel), pycparser==2.19(sdist), sagemaker==1.37.1(sdist), s3fs==0.3.3(sdist), pathlib==1.0.1(sdist), cryptography==2.7(wheel), fsspec==0.4.1(sdist), texttable==0.9.1(sdist), dockerpty==0.4.1(sdist), protobuf==3.9.1(wheel), cffi==1.12.3(wheel), pynacl==1.3.0(wheel), pandas==0.25.0(wheel), docopt==0.6.2(sdist), pywin32==224(wheel), bcrypt==3.1.7(wheel)}
2019-08-20 09:31:20 Downloading missing wheels: {pyyaml==3.13(wheel), numpy==1.17.0(wheel), protobuf3-to-dict==0.1.5(sdist), pycparser==2.19(sdist), scipy==1.3.1(wheel), sagemaker==1.37.1(sdist), s3fs==0.3.3(sdist), pathlib==1.0.1(sdist), cryptography==2.7(wheel), fsspec==0.4.1(sdist), texttable==0.9.1(sdist), dockerpty==0.4.1(sdist), protobuf==3.9.1(wheel), cffi==1.12.3(wheel), pynacl==1.3.0(wheel), pandas==0.25.0(wheel), docopt==0.6.2(sdist), pywin32==224(wheel), bcrypt==3.1.7(wheel)}
2019-08-20 09:31:20 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z pyyaml==3.13
2019-08-20 09:31:21 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z numpy==1.17.0
2019-08-20 09:31:27 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z protobuf3-to-dict==0.1.5
2019-08-20 09:31:28 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z pycparser==2.19
2019-08-20 09:31:29 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z scipy==1.3.1
2019-08-20 09:31:39 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z sagemaker==1.37.1
2019-08-20 09:31:40 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z s3fs==0.3.3
2019-08-20 09:31:41 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z pathlib==1.0.1
2019-08-20 09:31:42 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z cryptography==2.7
2019-08-20 09:31:44 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z fsspec==0.4.1
2019-08-20 09:31:45 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z texttable==0.9.1
2019-08-20 09:31:46 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z dockerpty==0.4.1
2019-08-20 09:31:47 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z protobuf==3.9.1
2019-08-20 09:31:49 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z cffi==1.12.3
2019-08-20 09:31:51 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z pynacl==1.3.0
2019-08-20 09:31:52 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z pandas==0.25.0
2019-08-20 09:32:01 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z docopt==0.6.2
2019-08-20 09:32:02 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\-------\AppData\Local\Temp\tmpnbl_t57z pywin32==224
2019-08-20 09:32:03 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp36m --dest C:\Users\------\AppData\Local\Temp\tmpnbl_t57z bcrypt==3.1.7
2019-08-20 09:32:04 compatible wheels after second download pass: {docker-pycreds==0.4.0(wheel), setuptools==41.1.0(wheel), botocore==1.12.211(wheel), boto3==1.9.211(wheel), websocket-client==0.56.0(wheel), paramiko==2.6.0(wheel), docker==3.7.3(wheel), scipy==1.3.1(wheel), jmespath==0.9.4(wheel), six==1.12.0(wheel), python-dateutil==2.8.0(wheel), docutils==0.15.2(wheel), chardet==3.0.4(wheel), requests==2.20.1(wheel), s3transfer==0.2.1(wheel), colorama==0.4.1(wheel), cached-property==1.5.1(wheel), asn1crypto==0.24.0(wheel), protobuf==3.9.1(wheel), jsonschema==2.6.0(wheel), pytz==2019.2(wheel), certifi==2019.6.16(wheel), numpy==1.17.0(wheel), idna==2.7(wheel), cffi==1.12.3(wheel), pypiwin32==223(wheel), pandas==0.25.0(wheel), urllib3==1.24.3(wheel), docker-compose==1.24.1(wheel)}
2019-08-20 09:32:04 Build missing wheels from sdists (C compiling True): {protobuf3-to-dict==0.1.5(sdist), pycparser==2.19(sdist), sagemaker==1.37.1(sdist), s3fs==0.3.3(sdist), pathlib==1.0.1(sdist), fsspec==0.4.1(sdist), texttable==0.9.1(sdist), dockerpty==0.4.1(sdist), docopt==0.6.2(sdist)}
2019-08-20 09:32:04 calling pip wheel --no-deps --wheel-dir C:\Users\-------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\protobuf3-to-dict-0.1.5.tar.gz
2019-08-20 09:32:07 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\pycparser-2.19.tar.gz
2019-08-20 09:32:10 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\sagemaker-1.37.1.tar.gz
2019-08-20 09:32:13 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\s3fs-0.3.3.tar.gz
2019-08-20 09:32:16 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\pathlib-1.0.1.tar.gz
2019-08-20 09:32:18 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\fsspec-0.4.1.tar.gz
2019-08-20 09:32:20 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\texttable-0.9.1.tar.gz
2019-08-20 09:32:23 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\dockerpty-0.4.1.tar.gz
2019-08-20 09:32:25 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\docopt-0.6.2.tar.gz
2019-08-20 09:32:28 compatible after building wheels (no C compiling): {docker-pycreds==0.4.0(wheel), setuptools==41.1.0(wheel), botocore==1.12.211(wheel), boto3==1.9.211(wheel), websocket-client==0.56.0(wheel), paramiko==2.6.0(wheel), docker==3.7.3(wheel), scipy==1.3.1(wheel), jmespath==0.9.4(wheel), six==1.12.0(wheel), python-dateutil==2.8.0(wheel), docutils==0.15.2(wheel), chardet==3.0.4(wheel), requests==2.20.1(wheel), s3transfer==0.2.1(wheel), colorama==0.4.1(wheel), cached-property==1.5.1(wheel), asn1crypto==0.24.0(wheel), protobuf==3.9.1(wheel), jsonschema==2.6.0(wheel), pytz==2019.2(wheel), certifi==2019.6.16(wheel), numpy==1.17.0(wheel), idna==2.7(wheel), cffi==1.12.3(wheel), pypiwin32==223(wheel), pandas==0.25.0(wheel), urllib3==1.24.3(wheel), docker-compose==1.24.1(wheel)}
2019-08-20 09:32:28 Build missing wheels from sdists (C compiling False): {protobuf3-to-dict==0.1.5(sdist), pycparser==2.19(sdist), sagemaker==1.37.1(sdist), s3fs==0.3.3(sdist), pathlib==1.0.1(sdist), fsspec==0.4.1(sdist), texttable==0.9.1(sdist), dockerpty==0.4.1(sdist), docopt==0.6.2(sdist)}
2019-08-20 09:32:28 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\protobuf3-to-dict-0.1.5.tar.gz
2019-08-20 09:32:28 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\pycparser-2.19.tar.gz
2019-08-20 09:32:28 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\sagemaker-1.37.1.tar.gz
2019-08-20 09:32:28 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\s3fs-0.3.3.tar.gz
2019-08-20 09:32:28 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\pathlib-1.0.1.tar.gz
2019-08-20 09:32:28 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\fsspec-0.4.1.tar.gz
2019-08-20 09:32:28 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\texttable-0.9.1.tar.gz
2019-08-20 09:32:28 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\dockerpty-0.4.1.tar.gz
2019-08-20 09:32:28 calling pip wheel --no-deps --wheel-dir C:\Users\------\AppData\Local\Temp\tmpnbl_t57z C:\Users\------\AppData\Local\Temp\tmpnbl_t57z\docopt-0.6.2.tar.gz
2019-08-20 09:32:28 compatible after building wheels (C compiling): {docker-pycreds==0.4.0(wheel), setuptools==41.1.0(wheel), botocore==1.12.211(wheel), boto3==1.9.211(wheel), websocket-client==0.56.0(wheel), paramiko==2.6.0(wheel), docker==3.7.3(wheel), scipy==1.3.1(wheel), jmespath==0.9.4(wheel), six==1.12.0(wheel), python-dateutil==2.8.0(wheel), docutils==0.15.2(wheel), chardet==3.0.4(wheel), requests==2.20.1(wheel), s3transfer==0.2.1(wheel), colorama==0.4.1(wheel), cached-property==1.5.1(wheel), asn1crypto==0.24.0(wheel), protobuf==3.9.1(wheel), jsonschema==2.6.0(wheel), pytz==2019.2(wheel), certifi==2019.6.16(wheel), numpy==1.17.0(wheel), idna==2.7(wheel), cffi==1.12.3(wheel), pypiwin32==223(wheel), pandas==0.25.0(wheel), urllib3==1.24.3(wheel), docker-compose==1.24.1(wheel)}
2019-08-20 09:32:28 Final compatible: {cached-property==1.5.1(wheel), docker-pycreds==0.4.0(wheel), asn1crypto==0.24.0(wheel), setuptools==41.1.0(wheel), protobuf==3.9.1(wheel), botocore==1.12.211(wheel), jsonschema==2.6.0(wheel), pytz==2019.2(wheel), boto3==1.9.211(wheel), certifi==2019.6.16(wheel), websocket-client==0.56.0(wheel), paramiko==2.6.0(wheel), urllib3==1.24.3(wheel), docker==3.7.3(wheel), numpy==1.17.0(wheel), scipy==1.3.1(wheel), idna==2.7(wheel), chardet==3.0.4(wheel), jmespath==0.9.4(wheel), six==1.12.0(wheel), cffi==1.12.3(wheel), pypiwin32==223(wheel), python-dateutil==2.8.0(wheel), docutils==0.15.2(wheel), requests==2.20.1(wheel), pandas==0.25.0(wheel), docker-compose==1.24.1(wheel), s3transfer==0.2.1(wheel), colorama==0.4.1(wheel)}
2019-08-20 09:32:28 Final incompatible: {pyyaml==3.13(wheel), numpy==1.17.0(wheel), scipy==1.3.1(wheel), cryptography==2.7(wheel), protobuf==3.9.1(wheel), cffi==1.12.3(wheel), pynacl==1.3.0(wheel), pandas==0.25.0(wheel), pywin32==224(wheel), bcrypt==3.1.7(wheel)}
2019-08-20 09:32:28 Final missing wheels: {pyyaml==3.13(wheel), protobuf3-to-dict==0.1.5(sdist), pycparser==2.19(sdist), sagemaker==1.37.1(sdist), s3fs==0.3.3(sdist), pathlib==1.0.1(sdist), cryptography==2.7(wheel), fsspec==0.4.1(sdist), texttable==0.9.1(sdist), dockerpty==0.4.1(sdist), pynacl==1.3.0(wheel), docopt==0.6.2(sdist), pywin32==224(wheel), bcrypt==3.1.7(wheel)}
2019-08-20 09:32:55 PythonPipBuilder:ResolveDependencies failed
Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\aws_lambda_builders\workflows\python_pip\actions.py", line 39, in execute
    self.scratch_dir
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\aws_lambda_builders\workflows\python_pip\packager.py", line 143, in build_dependencies
    requirements_path, artifacts_dir_path, scratch_dir_path)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\aws_lambda_builders\workflows\python_pip\packager.py", line 212, in build_site_packages
    raise MissingDependencyError(packages_without_wheels)
aws_lambda_builders.workflows.python_pip.packager.MissingDependencyError: {pyyaml==3.13(wheel), protobuf3-to-dict==0.1.5(sdist), pycparser==2.19(sdist), sagemaker==1.37.1(sdist), s3fs==0.3.3(sdist), pathlib==1.0.1(sdist), cryptography==2.7(wheel), fsspec==0.4.1(sdist), texttable==0.9.1(sdist), dockerpty==0.4.1(sdist), pynacl==1.3.0(wheel), docopt==0.6.2(sdist), pywin32==224(wheel), bcrypt==3.1.7(wheel)}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\aws_lambda_builders\workflow.py", line 248, in run
    action.execute()
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\aws_lambda_builders\workflows\python_pip\actions.py", line 42, in execute
    raise ActionFailedError(str(ex))
aws_lambda_builders.actions.ActionFailedError: {pyyaml==3.13(wheel), protobuf3-to-dict==0.1.5(sdist), pycparser==2.19(sdist), sagemaker==1.37.1(sdist), s3fs==0.3.3(sdist), pathlib==1.0.1(sdist), cryptography==2.7(wheel), fsspec==0.4.1(sdist), texttable==0.9.1(sdist), dockerpty==0.4.1(sdist), pynacl==1.3.0(wheel), docopt==0.6.2(sdist), pywin32==224(wheel), bcrypt==3.1.7(wheel)}

Build Failed
2019-08-20 09:32:55 Sending Telemetry: {'metrics': [{'commandRun': {'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'duration': 160781, 'exitReason': 'UserException', 'exitCode': 1, 'requestId': '943b9308-c11b-43e0-9d6d-5bbc984946ad', 'installationId': '0c5d4463-668a-4706-ae40-afd0704d66bd', 'sessionId': '4736e025-2966-4a4b-aeb6-2702fe347779', 'executionEnvironment': 'CLI', 'pyversion': '3.6.7', 'samcliVersion': '0.19.0'}}]}
2019-08-20 09:32:55 Starting new HTTPS connection (1): aws-serverless-tools-telemetry.us-west-2.amazonaws.com:443
2019-08-20 09:32:56 HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
Error: PythonPipBuilder:ResolveDependencies - {pyyaml==3.13(wheel), protobuf3-to-dict==0.1.5(sdist), pycparser==2.19(sdist), sagemaker==1.37.1(sdist), s3fs==0.3.3(sdist), pathlib==1.0.1(sdist), cryptography==2.7(wheel), fsspec==0.4.1(sdist), texttable==0.9.1(sdist), dockerpty==0.4.1(sdist), pynacl==1.3.0(wheel), docopt==0.6.2(sdist), pywin32==224(wheel), bcrypt==3.1.7(wheel)}

It seems for some reason it's not able to resolve compatible dependencies when the --use-container parameter is not set.

I am, fortunately, able to deploy the Lambda functions to AWS inside a container by deploying the template.yaml as a Serverless (CloudFormation) Application, if I don't check this box it fails too. Right click template.yaml Select build function inside a container

Answer

petrapower picture petrapower · Nov 7, 2019

I don't have an explanation of WHY this works with --use-container, but I had the same problem and nobody else seems to be answering this.

It appears that some of the libraries you are trying to use are missing wheel files. It actually says so in the debug message, but it's not easy to find if you don't know what you are looking for. More about wheels at https://pythonwheels.com/.

So, after a few hours of digging, I ran the following command in the terminal:

pip install wheel

After that, I could build, invoke the function locally, and deploy to AWS without the --use-container parameter.