sam build fails for python3.7 functions with pip==19.3 installed
See original GitHub issueDescription
with aws-sam-cli==0.22.0 and pip==19.3 installed sam build fails:
Building resource 'TestFunction'
Running PythonPipBuilder:ResolveDependencies
Build Failed
Error: PythonPipBuilder:ResolveDependencies - Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: 'module' object is not callabl
Steps to reproduce
template.yml
Transform: AWS::Serverless-2016-10-31
Resources:
TestFunction:
Type: AWS::Serverless::Function
Properties:
Handler: app.handler
Runtime: python3.7
requirements.txt
requests
commands to reproduce
pip install pip==19.3 aws-sam-cli==0.22.0
sam build
Observed result
command output with --debug
flag set.
Using SAM Template at /x/x/x/x/template.yml
Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
'build' command is called
No Parameters detected in the template
1 resources found in the template
Found Serverless function with name='TestFunction' and CodeUri='.'
Building resource 'TestFunction'
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)'
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 /home/ttb/axsemantics/code/eddaplayground/requirements.txt --dest /tmp/tmp4wnow8ph
PythonPipBuilder:ResolveDependencies failed
Traceback (most recent call last):
File "/home/ttb/.local/share/virtualenvs/eddaplayground-9KTS0LqI/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/actions.py", line 39, in execute
requirements_path=self.manifest_path
File "/home/ttb/.local/share/virtualenvs/eddaplayground-9KTS0LqI/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 "/home/ttb/.local/share/virtualenvs/eddaplayground-9KTS0LqI/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 209, in build_site_packages
scratch_directory, requirements_filepath)
File "/home/ttb/.local/share/virtualenvs/eddaplayground-9KTS0LqI/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 234, in _download_dependencies
requirements_filename, directory)
File "/home/ttb/.local/share/virtualenvs/eddaplayground-9KTS0LqI/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 "/home/ttb/.local/share/virtualenvs/eddaplayground-9KTS0LqI/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>
TypeError: 'module' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ttb/.local/share/virtualenvs/eddaplayground-9KTS0LqI/lib/python3.7/site-packages/aws_lambda_builders/workflow.py", line 248, in run
action.execute()
File "/home/ttb/.local/share/virtualenvs/eddaplayground-9KTS0LqI/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>
TypeError: 'module' object is not callable
Build Failed
Sending Telemetry: {'metrics': [{'commandRun': {'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'duration': 347, 'exitReason': 'UserException', 'exitCode': 1, 'requestId': 'b01b8130-a7a5-4176-8301-0e0b5a021a34', 'installationId': '8cd66ae9-04d8-4819-94c9-8b15f5cf52b7', 'sessionId': 'd530a4e3-c3aa-4bf3-a830-01f00e264479', 'executionEnvironment': 'CLI', 'pyversion': '3.7.4', 'samcliVersion': '0.22.0'}}]}
HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
Error: PythonPipBuilder:ResolveDependencies - Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: 'module' object is not callable
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: fedora 30
sam --version
: 0.22.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:18
- Comments:12 (4 by maintainers)
Top Results From Across the Web
sam build fails for python3.7 functions with pip==19.3 installed
I'm running into this issue on a build with Docker image lambci/lambda:build-python3.7. Supposedly it's using pip 19.0.3, but I'm still hitting ...
Read more >Python is not configured for aws sam cli - Stack Overflow
7 as your runtime for the app. The error occurs when there is mismatching the python version of your system. check python version:...
Read more >AWS Lambda function errors in Python
This page describes how to view Lambda function invocation errors for the Python runtime using the Lambda console and the AWS CLI.
Read more >aws-sam-cli - PyPI
SAM CLI provides a Lambda-like execution environment that lets you locally build, test, debug, and deploy AWS serverless applications. Install SAM CLI ·...
Read more >Changelog — Python 3.11.1 documentation
Python next: Release date: XXXX-XX-XX Core and Builtins: gh-100050: Honor existing errors obtained when searching for mismatching parentheses in the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had the same error with the same pip version. It was solved by lowering the version of pip.
pip install pip==19.2.3
This was released in v0.23.0.
Closing.