aws / aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
https://aws.amazon.com/serverless/sam/
Apache License 2.0
6.51k stars 1.17k forks source link

Failed to build runtime #1220

Closed pickfire closed 5 years ago

pickfire commented 5 years ago

Description

Failed to build from arch linux.

Steps to reproduce

  1. python -m venv venv
  2. source venv/bin/activate
  3. sam init --runtime python3.7
  4. cd sam-app
  5. sam build

Observed result

2019-06-10 15:46:42 Using SAM Template at /tmp/sam-app/template.yaml
2019-06-10 15:46:42 Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2019-06-10 15:46:42 Changing event name from before-call.apigateway to before-call.api-gateway
2019-06-10 15:46:42 Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2019-06-10 15:46:42 Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2019-06-10 15:46:42 Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2019-06-10 15:46:42 Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2019-06-10 15:46:42 Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2019-06-10 15:46:42 Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2019-06-10 15:46:42 Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2019-06-10 15:46:42 Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2019-06-10 15:46:42 Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2019-06-10 15:46:42 Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2019-06-10 15:46:42 Changing event name from before-call.apigateway to before-call.api-gateway
2019-06-10 15:46:42 Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2019-06-10 15:46:42 Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2019-06-10 15:46:42 Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2019-06-10 15:46:42 Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2019-06-10 15:46:42 Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2019-06-10 15:46:42 Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2019-06-10 15:46:42 Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2019-06-10 15:46:42 Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2019-06-10 15:46:42 Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2019-06-10 15:46:42 'build' command is called
2019-06-10 15:46:42 No Parameters detected in the template
2019-06-10 15:46:42 2 resources found in the template
2019-06-10 15:46:42 Found Serverless function with name='HelloWorldFunction' and CodeUri='hello_world/'
2019-06-10 15:46:42 Building resource 'HelloWorldFunction'
2019-06-10 15:46:42 Loading workflow module 'aws_lambda_builders.workflows'
2019-06-10 15:46:42 Registering workflow 'PythonPipBuilder' with capability 'Capability(language='python', dependency_manager='pip', application_framework=None)'
2019-06-10 15:46:42 Registering workflow 'NodejsNpmBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm', application_framework=None)'
2019-06-10 15:46:42 Registering workflow 'RubyBundlerBuilder' with capability 'Capability(language='ruby', dependency_manager='bundler', application_framework=None)'
2019-06-10 15:46:42 Registering workflow 'GoDepBuilder' with capability 'Capability(language='go', dependency_manager='dep', application_framework=None)'
2019-06-10 15:46:42 Registering workflow 'GoModulesBuilder' with capability 'Capability(language='go', dependency_manager='modules', application_framework=None)'
2019-06-10 15:46:42 Registering workflow 'JavaGradleWorkflow' with capability 'Capability(language='java', dependency_manager='gradle', application_framework=None)'
2019-06-10 15:46:42 Registering workflow 'JavaMavenWorkflow' with capability 'Capability(language='java', dependency_manager='maven', application_framework=None)'
2019-06-10 15:46:42 Registering workflow 'DotnetCliPackageBuilder' with capability 'Capability(language='dotnet', dependency_manager='cli-package', application_framework=None)'
2019-06-10 15:46:42 Found workflow 'PythonPipBuilder' to support capabilities 'Capability(language='python', dependency_manager='pip', application_framework=None)'
2019-06-10 15:46:42 Running workflow 'PythonPipBuilder'
2019-06-10 15:46:42 Running PythonPipBuilder:ResolveDependencies
2019-06-10 15:46:42 calling pip download -r /tmp/sam-app/hello_world/requirements.txt --dest /tmp/tmpnm2685ic
2019-06-10 15:46:42 PythonPipBuilder:ResolveDependencies failed
Traceback (most recent call last):
  File "/tmp/venv/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/actions.py", line 39, in execute
    self.scratch_dir
  File "/tmp/venv/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 143, in build_dependencies
    requirements_path, artifacts_dir_path, scratch_dir_path)
  File "/tmp/venv/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 209, in build_site_packages
    scratch_directory, requirements_filepath)
  File "/tmp/venv/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 234, in _download_dependencies
    requirements_filename, directory)
  File "/tmp/venv/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 330, in _download_all_dependencies
    self._pip.download_all_dependencies(requirements_filename, directory)
  File "/tmp/venv/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 632, in download_all_dependencies
    raise PackageDownloadError(error)
aws_lambda_builders.workflows.python_pip.packager.PackageDownloadError: Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pip'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/venv/lib/python3.7/site-packages/aws_lambda_builders/workflow.py", line 248, in run
    action.execute()
  File "/tmp/venv/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/actions.py", line 42, in execute
    raise ActionFailedError(str(ex))
aws_lambda_builders.actions.ActionFailedError: Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pip'

Build Failed
Error: PythonPipBuilder:ResolveDependencies - Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pip'

Expected result

Should build as how sam build --use-container does.

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

  1. OS: Linux cti 5.1.7-arch1-1-ARCH #1 SMP PREEMPT Tue Jun 4 15:47:45 UTC 2019 x86_64 GNU/Linux (Arch Linux)
  2. sam --version: SAM CLI, version 0.17.0
  3. python -V: Python 3.7.3
  4. pip -V: pip 19.0.3 from /tmp/venv/lib/python3.7/site-packages/pip (python 3.7)
sriram-mv commented 5 years ago

have you tried linuxbrew at all? it will give you isolated builds without having to install in a virtualenv and managing the scoping for it.

pickfire commented 5 years ago

@TheSriram No, why do we need isolated builds? Does not that add additional space for all the libraries? My disk space here is limited but my package manager still works fine.

awood45 commented 5 years ago

Are you able to run pip generally when you have that virtualenv activated? The error is appearing to be that pip for Python 3.7 can't be found by the build process.

pickfire commented 5 years ago

It appears that it works now on another device but I don't have the old device to reproduce it, will be closing this issue.