sam build fails when using pyjwt[crypto] in requirements.txt
See original GitHub issueDescription
If I include pyjwt[crypto] in the requiements.txt file, I get an error that says:
`(.venv) PS C:\Users\jwh> sam build --use-container Starting Build inside a container Building resource ‘AuthorizerFunction’ Failed to download a new lambci/lambda:build-python3.7 image. Invoking with the already downloaded image. Mounting C:\Users\jwh\apiauthexternal as /tmp/samcli/source:ro,delegated inside runtime container
Build Failed Error: PythonPipBuilder:ResolveDependencies - {cryptography==2.8(wheel)} Running PythonPipBuilder:ResolveDependencies`
Also fails w/o --use-container but with slightly different error:
Error: PythonPipBuilder:ResolveDependencies - {cryptography==2.8(wheel), pycparser==2.19(sdist)}
Note that I am running on Windows 10 platform here.
Steps to reproduce
- Create a Python Lambda project
- Add pyjwt[crypto] to requirements.txt
- sam build --use-container or sam build
Observed result
`sam build --use-container --debug Using SAM Template at C:\Users\jwh\aws\template.yaml 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 Collected default values for parameters: {‘StackUpdateComment’: ‘V1.1’, ‘AutoPublishAlias’: ‘dev’, ‘LineOfBusiness’: ‘cc’, ‘ExecutionEnvironment’: ‘dev’, ‘LogLevel’: ‘DEBUG’, ‘PrefixParameter’: ‘-001-s-031-e1-00-dev-’, ‘LambdaName’: ‘encore-api-internal-authorizer’} Unable to resolve property ManagedPolicyArns: [{‘Ref’: ‘LambdaPolicyDocument’}, {‘Fn::ImportValue’: ‘PolicyKMS’}]. Leaving as is. Unable to resolve property Events: None. Leaving as is. 4 resources found in the template Found Serverless function with name=‘AuthorizerFunction’ and CodeUri=‘apiauthexternal/’ Building resource ‘AuthorizerFunction’ Failed to download image with name lambci/lambda:build-python3.7 Failed to download a new lambci/lambda:build-python3.7 image. Invoking with the already downloaded image. Mounting C:\Users\jwh\apiauthexternal 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)’ 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: {cffi==1.13.2(wheel), pyjwt==1.7.1(wheel), pycparser==2.19(sdist), cryptography==2.8(wheel), six==1.12.0(wheel)} initial compatible: {cffi==1.13.2(wheel), pyjwt==1.7.1(wheel), six==1.12.0(wheel)} initial incompatible: {pycparser==2.19(sdist), cryptography==2.8(wheel)} Downloading missing wheels: {pycparser==2.19(sdist), cryptography==2.8(wheel)} calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp37m --dest /tmp/samcli/scratch pycparser==2.19 calling pip download --only-binary=:all: --no-deps --platform manylinux1_x86_64 --implementation cp --abi cp37m --dest /tmp/samcli/scratch cryptography==2.8 compatible wheels after second download pass: {cffi==1.13.2(wheel), pyjwt==1.7.1(wheel), six==1.12.0(wheel)} Build missing wheels from sdists (C compiling True): {pycparser==2.19(sdist)} calling pip wheel --no-deps --wheel-dir /tmp/samcli/scratch /tmp/samcli/scratch/pycparser-2.19.tar.gz compatible after building wheels (no C compiling): {cffi==1.13.2(wheel), pycparser==2.19(wheel), pyjwt==1.7.1(wheel), six==1.12.0(wheel)} Build missing wheels from sdists (C compiling False): set() compatible after building wheels (C compiling): {cffi==1.13.2(wheel), pycparser==2.19(wheel), pyjwt==1.7.1(wheel), six==1.12.0(wheel)} Final compatible: {cffi==1.13.2(wheel), pycparser==2.19(wheel), pyjwt==1.7.1(wheel), six==1.12.0(wheel)} Final incompatible: {cryptography==2.8(wheel)} Final missing wheels: {cryptography==2.8(wheel)} PythonPipBuilder:ResolveDependencies failed Traceback (most recent call last): File “/var/lang/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/actions.py”, line 39, in execute requirements_path=self.manifest_path File “/var/lang/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 “/var/lang/lib/python3.7/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: {cryptography==2.8(wheel)}
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File “/var/lang/lib/python3.7/site-packages/aws_lambda_builders/workflow.py”, line 248, in run action.execute() File “/var/lang/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: {cryptography==2.8(wheel)} Builder workflow failed Traceback (most recent call last): File “/var/lang/lib/python3.7/site-packages/aws_lambda_builders/workflows/python_pip/actions.py”, line 39, in execute requirements_path=self.manifest_path File “/var/lang/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 “/var/lang/lib/python3.7/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: {cryptography==2.8(wheel)}
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File “/var/lang/lib/python3.7/site-packages/aws_lambda_builders/workflow.py”, line 248, in run action.execute() File “/var/lang/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: {cryptography==2.8(wheel)}
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File “/var/lang/lib/python3.7/site-packages/aws_lambda_builders/main.py”, line 137, in main mode=params.get(‘mode’, None)) File “/var/lang/lib/python3.7/site-packages/aws_lambda_builders/builder.py”, line 115, in build return workflow.run() File “/var/lang/lib/python3.7/site-packages/aws_lambda_builders/workflow.py”, line 65, in wrapper func(self, *args, **kwargs) File “/var/lang/lib/python3.7/site-packages/aws_lambda_builders/workflow.py”, line 257, in run reason=str(ex)) aws_lambda_builders.exceptions.WorkflowFailedError: PythonPipBuilder:ResolveDependencies - {cryptography==2.8(wheel)} Build inside container returned response {“jsonrpc”: “2.0”, “id”: 1, “error”: {“code”: 400, “message”: “PythonPipBuilder:ResolveDependencies - {cryptography==2.8(wheel)}”}}
Build Failed Sending Telemetry: {‘metrics’: [{‘commandRun’: {‘awsProfileProvided’: False, ‘debugFlagProvided’: True, ‘region’: ‘’, ‘commandName’: ‘sam build’, ‘duration’: 26196, ‘exitReason’: ‘UserException’, ‘exitCode’: 1, ‘requestId’: ‘d21ab057-cbdc-42ef-9235-3aad41033971’, ‘installationId’: ‘93177b47-57bd-4b5b-9211-97cbbf2cefe2’, ‘sessionId’: ‘e5484581-086e-43bf-9834-92c7be077d75’, ‘executionEnvironment’: ‘CLI’, ‘pyversion’: ‘3.6.7’, ‘samcliVersion’: ‘0.30.0’}}]} HTTPSConnectionPool(host=‘aws-serverless-tools-telemetry.us-west-2.amazonaws.com’, port=443): Read timed out. (read timeout=0.1) Error: PythonPipBuilder:ResolveDependencies - {cryptography==2.8(wheel)}`
Expected result
Successful build
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: Windows 10
sam --version
: SAM CLI, version 0.30.0
Add --debug flag to command you are running
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
I specifically pulled the latest Docker image. I did see that earlier issue and it seems similar but not exactly the same. FWIW, I found that I could work around this issue by creating my own Docker image, installing parakmiko in that image, re-tagging the image as:
Here is the Dockerfile I’m using:
After this tag the new image with lambci/lambda:build-python3.7 docker tag <image_id> lambci/lambda:build-python3.7 So that ‘sam build --use-container’ will use the modified image
This works perfectly but if I leave out the paramiko install, it fails every time.
@dmitry-weirdo I have exactly the same issue, trying to avoid the use-container overhead
What wheel version do you use ? What cryptography version ?