Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sam build doesn't work with cvxpy in requirements #2148

Open
dmasip-rxd opened this issue Jul 31, 2020 · 2 comments
Open

sam build doesn't work with cvxpy in requirements #2148

dmasip-rxd opened this issue Jul 31, 2020 · 2 comments
Assignees
Labels
stage/needs-investigation Requires a deeper investigation type/bug

Comments

@dmasip-rxd
Copy link

dmasip-rxd commented Jul 31, 2020

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
@mndeveci mndeveci self-assigned this Aug 14, 2020
@mndeveci
Copy link
Contributor

mndeveci commented Aug 14, 2020

After testing with various environments;

  • Running sam build on OSX fails with following missing dependencies: {cvxpy==1.1.3(wheel), scs==2.1.2(sdist)}
  • Running sam build on Linux succeeds

Tested building inside container with different runtimes;

  • Running sam build -u with Python 3.6 fails with following missing dependencies: {cvxpy==1.1.3(sdist), scs==2.1.2(sdist)}
  • Running sam build -u with Python 3.7 fails with following missing dependencies: {cvxpy==1.1.3(sdist)}
  • Running sam build -u with Python 3.8 succeeds

Needs further investigation.

@mndeveci mndeveci added stage/needs-investigation Requires a deeper investigation type/bug labels Aug 14, 2020
@hoffa
Copy link
Contributor

hoffa commented Feb 22, 2021

Tangential: error message doesn't seem helpful, might same issue as aws/aws-lambda-builders#363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/needs-investigation Requires a deeper investigation type/bug
Projects
None yet
Development

No branches or pull requests

3 participants