aws / aws/aws-sam-cli

sam build doesn't work with `cvxpy` in requirements

Open
#2,148 2 comments 2 reactions 1 assignee Claimed by @mndeveci View on GitHub
stage/needs-investigation type/bug
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Description

When putting cvxpy in requirements, `sam build --use-container` returns

```Error: PythonPipBuilder:ResolveDependencies - {cvxpy==1.1.3(sdist)}```

This doesn't work with version 1.0.0, but it works with 0.53.0.

### Steps to reproduce

Minimal example:
* `sam init` and choose python 3.7 tutorial.
* Change the `hello_world/requirements.txt` file to:
```
requests
cvxpy==1.1.3
```
* run `sam build --use-container ` (or `sam build --use-container --debug`)

### Observed result

```
Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
'build' command is called
Starting Build inside a container
No Parameters detected in the template
2 resources found in the template
Found Serverless function with name='HelloWorldFunction' and CodeUri='hello_world/'
No Parameters detected in the template
Building function 'HelloWorldFunction'

Fetching amazon/aws-sam-cli-build-image-python3.7 Docker container image......
Mounting /Users/davidmasip/Documents/Others/sam-app/hello_world as /tmp/samcli/source:ro,delegated inside runtime container
Using the request object from command line argument
Loading workflow module 'aws_lambda_builders.workflows'
Registering workflow 'PythonPipBuilder' with capability 'Capability(language='python', dependency_manager='pip', application_framework=None)'
Registering workflow 'NodejsNpmBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm', application_framework=None)'
Registering workflow 'RubyBundlerBuilder' with capability 'Capability(language='ruby', dependency_manager='bundler', application_framework=None)'
Registering workflow 'GoDepBuilder' with capability 'Capability(language='go', dependency_manager='dep', application_framework=None)'
Registering workflow 'GoModulesBuilder' with capability 'Capability(language='go', dependency_manager='modules', application_framework=None)'
Registering workflow 'JavaGradleWorkflow' with capability 'Capability(language='java', dependency_manager='gradle', application_framework=None)'
Registering workflow 'JavaMavenWorkflow' with capability 'Capability(language='java', dependency_manager='maven', application_framework=None)'
Registering workflow 'DotnetCliPackageBuilder' with capability 'Capability(language='dotnet', dependency_manager='cli-package', application_framework=None)'
Registering workflow 'CustomMakeBuilder' with capability 'Capability(language='provided', dependency_manager=None, application_framework=None)'
Found workflow 'PythonPipBuilder' to support capabilities 'Capability(language='python', dependency_manager='pip', application_framework=None)'
Running workflow 'PythonPipBuilder'
Running PythonPipBuilder:ResolveDependencies
calling pip download -r /tmp/samcli/source/requirements.txt --dest /tmp/samcli/scratch
Full dependency closure: {requests==2.24.0(wheel), certifi==2020.6.20(wheel), urllib3==1.25.10(wheel), numpy==1.19.1(wheel), cvxpy==1.1.3(sdist), scs==2.1.2(sdist), ecos==2.0.7.post1(wheel), chardet==3.0.4(wheel), osqp==0.6.1(wheel), scipy==1.5.2(wheel), future==0.18.2(sdist), idna==2.10(wheel)}
initial compatible: {requests==2.24.0(wheel), certifi==2020.6.20(wheel), idna==2.10(wheel), ecos==2.0.7.post1(wheel), chardet==3.0.4(wheel), scipy==1.5.2(wheel), urllib3==1.25.10(wheel)}
initial incompatible: {osqp==0.6.1(wheel), future==0.18.2(sdist), numpy==1.19.1(wheel), cvxpy==1.1.3(sdist), scs==2.1.2(sdist)}
Downloading missing wheels: {osqp==0.6.1(wheel), future==0.18.2(sdist), numpy==1.19.1(wheel), cvxpy==1.1.3(sdist), scs==2.1.2(sdist)}
calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp37m --dest /tmp/samcli/scratch osqp==0.6.1
calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp37m --dest /tmp/samcli/scratch future==0.18.2
calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp37m --dest /tmp/samcli/scratch numpy==1.19.1
calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp37m --dest /tmp/samcli/scratch cvxpy==1.1.3
calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp37m --dest /tmp/samcli/scratch scs==2.1.2
compatible wheels after second download pass: {requests==2.24.0(wheel), certifi==2020.6.20(wheel), urllib3==1.25.10(wheel), numpy==1.19.1(wheel), ecos==2.0.7.post1(wheel), chardet==3.0.4(wheel), osqp==0.6.1(wheel), scipy==1.5.2(wheel), idna==2.10(wheel)}
Build missing wheels from sdists (C compiling True): {future==0.18.2(sdist), cvxpy==1.1.3(sdist), scs==2.1.2(sdist)}
calling pip wheel --no-deps --wheel-dir /tmp/samcli/scratch /tmp/samcli/scratch/future-0.18.2.tar.gz
calling pip wheel --no-deps --wheel-dir /tmp/samcli/scratch /tmp/samcli/scratch/cvxpy-1.1.3.tar.gz
calling pip wheel --no-deps --wheel-dir /tmp/samcli/scratch /tmp/samcli/scratch/scs-2.1.2.tar.gz
compatible after building wheels (no C compiling): {requests==2.24.0(wheel), certifi==2020.6.20(wheel), urllib3==1.25.10(wheel), numpy==1.19.1(wheel), scs==2.1.2(wheel), ecos==2.0.7.post1(wheel), chardet==3.0.4(wheel), osqp==0.6.1(wheel), scipy==1.5.2(wheel), future==0.18.2(wheel), idna==2.10(wheel)}
Build missing wheels from sdists (C compiling False): {cvxpy==1.1.3(sdist)}
calling pip wheel --no-deps --wheel-dir /tmp/samcli/scratch /tmp/samcli/scratch/cvxpy-1.1.3.tar.gz
compatible after building wheels (C compiling): {requests==2.24.0(wheel), certifi==2020.6.20(wheel), urllib3==1.25.10(wheel), numpy==1.19.1(wheel), scs==2.1.2(wheel), ecos==2.0.7.post1(wheel), chardet==3.0.4(wheel), osqp==0.6.1(wheel), scipy==1.5.2(wheel), future==0.18.2(wheel), idna==2.10(wheel)}
Final compatible: {requests==2.24.0(wheel), certifi==2020.6.20(wheel), urllib3==1.25.10(wheel), numpy==1.19.1(wheel), scs==2.1.2(wheel), ecos==2.0.7.post1(wheel), chardet==3.0.4(wheel), osqp==0.6.1(wheel), scipy==1.5.2(wheel), future==0.18.2(wheel), idna==2.10(wheel)}
Final incompatible: {numpy==1.19.1(wheel), osqp==0.6.1(wheel)}
Final missing wheels: {cvxpy==1.1.3(sdist)}
PythonPipBuilder:ResolveDependencies failed
Traceback (most recent call last):
File "/usr/local/opt/sam-cli/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/actions.py", line 42, in execute
requirements_path=self.manifest_path,
File "/usr/local/opt/sam-cli/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 137, in build_dependencies
self._dependency_builder.build_site_packages(requirements_path, artifacts_dir_path, scratch_dir_path)
File "/usr/local/opt/sam-cli/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 201, in build_site_packages
raise MissingDependencyError(packages_without_wheels)
aws_lambda_builders.workflows.python_pip.packager.MissingDependencyError: {cvxpy==1.1.3(sdist)}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/opt/sam-cli/lib/python3.7/site-packages/aws_lambda_builders/workflow.py", line 269, in run
action.execute()
File "/usr/local/opt/sam-cli/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/actions.py", line 45, in execute
raise ActionFailedError(str(ex))
aws_lambda_builders.actions.ActionFailedError: {cvxpy==1.1.3(sdist)}
Builder workflow failed
Traceback (most recent call last):
File "/usr/local/opt/sam-cli/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/actions.py", line 42, in execute
requirements_path=self.manifest_path,
File "/usr/local/opt/sam-cli/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 137, in build_dependencies
self._dependency_builder.build_site_packages(requirements_path, artifacts_dir_path, scratch_dir_path)
File "/usr/local/opt/sam-cli/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 201, in build_site_packages
raise MissingDependencyError(packages_without_wheels)
aws_lambda_builders.workflows.python_pip.packager.MissingDependencyError: {cvxpy==1.1.3(sdist)}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/opt/sam-cli/lib/python3.7/site-packages/aws_lambda_builders/workflow.py", line 269, in run
action.execute()
File "/usr/local/opt/sam-cli/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/actions.py", line 45, in execute
raise ActionFailedError(str(ex))
aws_lambda_builders.actions.ActionFailedError: {cvxpy==1.1.3(sdist)}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/opt/sam-cli/lib/python3.7/site-packages/aws_lambda_builders/__main__.py", line 126, in main
mode=params.get("mode", None),
File "/usr/local/opt/sam-cli/lib/python3.7/site-packages/aws_lambda_builders/builder.py", line 125, in build
return workflow.run()
File "/usr/local/opt/sam-cli/lib/python3.7/site-packages/aws_lambda_builders/workflow.py", line 76, in wrapper
func(self, *args, **kwargs)
File "/usr/local/opt/sam-cli/lib/python3.7/site-packages/aws_lambda_builders/workflow.py", line 276, in run
raise WorkflowFailedError(workflow_name=self.NAME, action_name=action.NAME, reason=str(ex))
aws_lambda_builders.exceptions.WorkflowFailedError: PythonPipBuilder:ResolveDependencies - {cvxpy==1.1.3(sdist)}
Build inside container returned response {"jsonrpc": "2.0", "id": 1, "error": {"code": 400, "message": "PythonPipBuilder:ResolveDependencies - {cvxpy==1.1.3(sdist)}"}}

Build Failed
Sending Telemetry: {'metrics': [{'commandRun': {'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'duration': 65545, 'exitReason': 'BuildInsideContainerError', 'exitCode': 1, 'requestId': '2c128a07-823c-4cc1-9e65-df4676426ae8', 'installationId': '134b2c7a-807a-40eb-b92d-283ee86b76ce', 'sessionId': '88b505c6-b032-493b-8fb3-9c276193fcd2', 'executionEnvironment': 'CLI', 'pyversion': '3.7.8', 'samcliVersion': '1.0.0'}}]}
HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
Error: PythonPipBuilder:ResolveDependencies - {cvxpy==1.1.3(sdist)}

```

### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

1. OS: macOs Catalina 10.15.2
2. `sam --version`: 1.0.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.