question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SAM Accelerate fails to resolve dependencies during build

See original GitHub issue

Description:

I cannot get the sample hello-world SAM application to work with SAM Accelerate to work. No matter what I do, I see an error.

samcli.commands.exceptions.UserException: PythonPipBuilder:ResolveDependencies - Could not satisfy the requirement: requests

Note that requests is installed and available to my chosen runtime, python3.8.

foo@bar:~/sam-tutorial$ python3.8 -m pip freeze | grep requests
requests==2.28.1

Also note that I am experiencing this issue with an actual application. I have created a StackOverflow question, but as yet no one has responded. I’m hoping someone here will be able to help.

Steps to reproduce:

I followed the steps as described in Getting started with AWS SAM Accelerate.

The only difference is that I used runtime python3.8, as that is my chosen runtime.

Observed result:

am init --app-template hello-world --name sam-tutorial --package-type Zip --runtime python3.8 --debug
2022-07-13 11:12:56,158 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2022-07-13 11:12:56,158 | Using config file: samconfig.toml, config environment: default
2022-07-13 11:12:56,158 | Expand command line arguments to:
2022-07-13 11:12:56,158 | --app_template=hello-world --name=sam-tutorial --package_type=Zip --runtime=python3.8 --output_dir=. 
2022-07-13 11:12:56,529 | Template runtime graalvm.java11 (provided.al2) does not match filter value python3.8
2022-07-13 11:12:56,529 | Template runtime graalvm.java17 (provided.al2) does not match filter value python3.8
2022-07-13 11:12:56,529 | Template runtime dotnetcore3.1 does not match filter value python3.8
2022-07-13 11:12:56,529 | Template runtime dotnet6 does not match filter value python3.8
2022-07-13 11:12:56,529 | Template runtime go1.x does not match filter value python3.8
2022-07-13 11:12:56,530 | Template runtime java8 does not match filter value python3.8
2022-07-13 11:12:56,530 | Template runtime java8.al2 does not match filter value python3.8
2022-07-13 11:12:56,530 | Template runtime java11 does not match filter value python3.8
2022-07-13 11:12:56,530 | Template runtime nodejs16.x does not match filter value python3.8
2022-07-13 11:12:56,530 | Template runtime amazon/nodejs16.x-base does not match filter value python3.8
2022-07-13 11:12:56,530 | Template runtime nodejs14.x does not match filter value python3.8
2022-07-13 11:12:56,530 | Template runtime nodejs12.x does not match filter value python3.8
2022-07-13 11:12:56,530 | Template runtime python3.6 does not match filter value python3.8
2022-07-13 11:12:56,530 | Template runtime python3.7 does not match filter value python3.8
2022-07-13 11:12:56,530 | Template runtime python3.9 does not match filter value python3.8
2022-07-13 11:12:56,530 | Template runtime ruby2.7 does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime rust (provided.al2) does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime amazon/nodejs14.x-base does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime amazon/nodejs12.x-base does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime amazon/python3.8-base does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime amazon/python3.9-base does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime amazon/ruby2.7-base does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime amazon/go1.x-base does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime amazon/java11-base does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime amazon/dotnet6-base does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime amazon/dotnet5.0-base does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime amazon/dotnetcore3.1-base does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime amazon/python3.7-base does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime amazon/python3.6-base does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime amazon/java8-base does not match filter value python3.8
2022-07-13 11:12:56,531 | Template runtime amazon/java8.al2-base does not match filter value python3.8

Based on your selections, the only Template available is Hello World Example.
We will proceed to selecting the Template as Hello World Example.

Based on your selections, the only dependency manager available is pip.
We will proceed copying the template using pip.

Would you like to enable X-Ray tracing on the function(s) in your application?  [y/N]: X-Ray will incur an additional cost. View https://aws.amazon.com/xray/pricing/ for more details
2022-07-13 11:18:26,388 | 
Cloning from https://github.com/aws/aws-sam-cli-app-templates (process may take a moment)
2022-07-13 11:18:47,685 | Removing old repo at /home/dgard/.aws-sam/aws-sam-cli-app-templates
2022-07-13 11:18:47,755 | Copying from /tmp/tmpekpdbxi9/aws-sam-cli-app-templates to /home/dgard/.aws-sam/aws-sam-cli-app-templates

    -----------------------
    Generating application:
    -----------------------
    Name: sam-tutorial
    Runtime: python3.8
    Architectures: x86_64
    Dependency Manager: pip
    Application Template: hello-world
    Output Directory: .
    
    Next steps can be found in the README file at ./sam-tutorial/README.md
        

    Commands you can use next
    =========================
    [*] Create pipeline: cd sam-tutorial && sam pipeline init --bootstrap
    [*] Validate SAM template: sam validate
    [*] Test Function in the Cloud: sam sync --stack-name {stack-name} --watch
    
2022-07-13 11:18:48,074 | Parameters dict created with input given
2022-07-13 11:18:48,074 | {'template': '/home/dgard/.aws-sam/aws-sam-cli-app-templates/python3.8/cookiecutter-aws-sam-hello-python', 'output_dir': '.', 'no_input': True, 'extra_context': {'project_name': 'sam-tutorial', 'runtime': 'python3.8', 'architectures': {'value': ['x86_64']}}}
2022-07-13 11:18:48,074 | Baking a new template with cookiecutter with all parameters
2022-07-13 11:18:48,121 | Template is not provided in context, skip adding project type metric
2022-07-13 11:18:48,122 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': '1e45a37f-6666-4c20-92ca-62676513ea66', 'installationId': '74a8e876-2017-4104-be01-699f1ead265d', 'sessionId': '5c1448ea-c3fb-4495-84fc-15f771568140', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.7.10', 'samcliVersion': '1.53.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam init', 'duration': 351964, 'exitReason': 'success', 'exitCode': 0}}]}
2022-07-13 11:18:48,835 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
sam sync --watch --stack-name sam-app
2022-07-13 11:20:51,931 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2022-07-13 11:20:51,935 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2022-07-13 11:20:51,936 | Sending Telemetry: {'metrics': [{'templateWarning': {'requestId': '00725dd7-4d7c-40c6-8886-e1e651c3ab46', 'installationId': '74a8e876-2017-4104-be01-699f1ead265d', 'sessionId': '8ac9906e-406b-4529-bb60-b621f9f688ae', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.7.10', 'samcliVersion': '1.53.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'warningName': 'CodeDeployWarning', 'warningCount': 0}}]}
2022-07-13 11:20:52,661 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
2022-07-13 11:20:52,662 | Sending Telemetry: {'metrics': [{'templateWarning': {'requestId': '22220a5b-939a-4b3c-a442-71f123234dba', 'installationId': '74a8e876-2017-4104-be01-699f1ead265d', 'sessionId': '8ac9906e-406b-4529-bb60-b621f9f688ae', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.7.10', 'samcliVersion': '1.53.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'warningName': 'CodeDeployConditionWarning', 'warningCount': 0}}]}
2022-07-13 11:20:53,408 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
2022-07-13 11:20:53,409 | Using config file: samconfig.toml, config environment: default
2022-07-13 11:20:53,409 | Expand command line arguments to:
2022-07-13 11:20:53,409 | --template_file=/home/dgard/sam-tutorial/template.yaml --watch --stack_name=sam-app --dependency_layer --capabilities=('CAPABILITY_NAMED_IAM', 'CAPABILITY_AUTO_EXPAND') 

The SAM CLI will use the AWS Lambda, Amazon API Gateway, and AWS StepFunctions APIs to upload your code without 
performing a CloudFormation deployment. This will cause drift in your CloudFormation stack. 
**The sync command should only be used against a development stack**.
Confirm that you are synchronizing a development stack.

Enter Y to proceed with the command, or enter N to cancel:
 [Y/n]: 2022-07-13 11:20:59,321 | Using build directory as .aws-sam/auto-dependency-layer
2022-07-13 11:20:59,326 | No Parameters detected in the template
2022-07-13 11:20:59,339 | There is no customer defined id or cdk path defined for resource HelloWorldFunction, so we will use the resource logical id as the resource id
2022-07-13 11:20:59,339 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical id as the resource id
2022-07-13 11:20:59,340 | 0 stacks found in the template
2022-07-13 11:20:59,340 | No Parameters detected in the template
2022-07-13 11:20:59,350 | There is no customer defined id or cdk path defined for resource HelloWorldFunction, so we will use the resource logical id as the resource id
2022-07-13 11:20:59,350 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical id as the resource id
2022-07-13 11:20:59,351 | 2 resources found in the stack 
2022-07-13 11:20:59,351 | Found Serverless function with name='HelloWorldFunction' and CodeUri='hello_world/'
2022-07-13 11:20:59,351 | --base-dir is not presented, adjusting uri hello_world/ relative to /home/dgard/sam-tutorial/template.yaml
2022-07-13 11:20:59,352 | Entering sync context, previous state: SyncState(dependency_layer=True), current state: SyncState(dependency_layer=True)
2022-07-13 11:20:59,352 | Queued infra sync. Wating for in progress code syncs to complete...
2022-07-13 11:20:59,352 | Starting infra sync.
2022-07-13 11:20:59,357 | No Parameters detected in the template
2022-07-13 11:20:59,367 | There is no customer defined id or cdk path defined for resource HelloWorldFunction, so we will use the resource logical id as the resource id
2022-07-13 11:20:59,367 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical id as the resource id
2022-07-13 11:20:59,367 | 0 stacks found in the template
2022-07-13 11:20:59,367 | No Parameters detected in the template
2022-07-13 11:20:59,377 | There is no customer defined id or cdk path defined for resource HelloWorldFunction, so we will use the resource logical id as the resource id
2022-07-13 11:20:59,377 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical id as the resource id
2022-07-13 11:20:59,378 | 2 resources found in the stack 
2022-07-13 11:20:59,378 | Found Serverless function with name='HelloWorldFunction' and CodeUri='hello_world/'
2022-07-13 11:20:59,378 | --base-dir is not presented, adjusting uri hello_world/ relative to /home/dgard/sam-tutorial/template.yaml
2022-07-13 11:20:59,383 | Your template contains a resource with logical ID "ServerlessRestApi", which is a reserved logical ID in AWS SAM. It could result in unexpected behaviors and is not recommended.
2022-07-13 11:20:59,383 | Instantiating build definitions
2022-07-13 11:20:59,385 | Same function build definition found, adding function (Previous: BuildDefinition(python3.8, /home/dgard/sam-tutorial/hello_world, Zip, , 1cf4852e-50c5-4085-91a6-4245ec92629b, {}, {}, x86_64, []), Current: BuildDefinition(python3.8, /home/dgard/sam-tutorial/hello_world, Zip, , fd6e32fd-efdb-4abc-b71f-20a46420f4a4, {}, {}, x86_64, []), Function: Function(function_id='HelloWorldFunction', name='HelloWorldFunction', functionname='HelloWorldFunction', runtime='python3.8', memory=None, timeout=3, handler='app.lambda_handler', imageuri=None, packagetype='Zip', imageconfig=None, codeuri='/home/dgard/sam-tutorial/hello_world', environment=None, rolearn=None, layers=[], events={'HelloWorld': {'Type': 'Api', 'Properties': {'Path': '/hello', 'Method': 'get', 'RestApiId': 'ServerlessRestApi'}}}, metadata={'SamResourceId': 'HelloWorldFunction'}, inlinecode=None, codesign_config_arn=None, architectures=['x86_64'], function_url_config=None, stack_path=''))
2022-07-13 11:20:59,386 | Async execution started
2022-07-13 11:20:59,386 | Invoking function functools.partial(<bound method ParallelBuildStrategy.build_single_function_definition of <samcli.lib.build.build_strategy.ParallelBuildStrategy object at 0x7f429eedeb50>>, <samcli.lib.build.build_graph.FunctionBuildDefinition object at 0x7f429eea0f10>)
2022-07-13 11:20:59,387 | Running incremental build for runtime python3.8 for following resources (HelloWorldFunction)
2022-07-13 11:20:59,387 | Manifest file is changed (new hash: 3298f13049d19cffaa37ca931dd4d421) or dependency folder (.aws-sam/deps/1cf4852e-50c5-4085-91a6-4245ec92629b) is missing for (HelloWorldFunction), downloading dependencies and copying/building source
2022-07-13 11:20:59,387 | Building codeuri: /home/dgard/sam-tutorial/hello_world runtime: python3.8 metadata: {} architecture: x86_64 functions: HelloWorldFunction
2022-07-13 11:20:59,387 | Building to following folder /home/dgard/sam-tutorial/.aws-sam/auto-dependency-layer/HelloWorldFunction
2022-07-13 11:20:59,387 | Waiting for async results
2022-07-13 11:20:59,388 | Loading workflow module 'aws_lambda_builders.workflows'
2022-07-13 11:20:59,390 | Registering workflow 'PythonPipBuilder' with capability 'Capability(language='python', dependency_manager='pip', application_framework=None)'
2022-07-13 11:20:59,390 | Registering workflow 'NodejsNpmBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm', application_framework=None)'
2022-07-13 11:20:59,391 | Registering workflow 'RubyBundlerBuilder' with capability 'Capability(language='ruby', dependency_manager='bundler', application_framework=None)'
2022-07-13 11:20:59,392 | Registering workflow 'GoModulesBuilder' with capability 'Capability(language='go', dependency_manager='modules', application_framework=None)'
2022-07-13 11:20:59,393 | Registering workflow 'JavaGradleWorkflow' with capability 'Capability(language='java', dependency_manager='gradle', application_framework=None)'
2022-07-13 11:20:59,394 | Registering workflow 'JavaMavenWorkflow' with capability 'Capability(language='java', dependency_manager='maven', application_framework=None)'
2022-07-13 11:20:59,395 | Registering workflow 'DotnetCliPackageBuilder' with capability 'Capability(language='dotnet', dependency_manager='cli-package', application_framework=None)'
2022-07-13 11:20:59,396 | Registering workflow 'CustomMakeBuilder' with capability 'Capability(language='provided', dependency_manager=None, application_framework=None)'
2022-07-13 11:20:59,397 | Registering workflow 'NodejsNpmEsbuildBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm-esbuild', application_framework=None)'
2022-07-13 11:20:59,397 | Found workflow 'PythonPipBuilder' to support capabilities 'Capability(language='python', dependency_manager='pip', application_framework=None)'
2022-07-13 11:20:59,446 | Running workflow 'PythonPipBuilder'
2022-07-13 11:20:59,446 | Running PythonPipBuilder:CleanUp
2022-07-13 11:20:59,446 | Clean up action: .aws-sam/deps/1cf4852e-50c5-4085-91a6-4245ec92629b does not exist and will be skipped.
2022-07-13 11:20:59,446 | PythonPipBuilder:CleanUp succeeded
2022-07-13 11:20:59,446 | Running PythonPipBuilder:ResolveDependencies
2022-07-13 11:20:59,464 | calling pip download -r /home/dgard/sam-tutorial/hello_world/requirements.txt --dest /tmp/tmpba33lles --exists-action i
2022-07-13 11:21:01,120 | PythonPipBuilder:ResolveDependencies failed
Traceback (most recent call last):
  File "aws_lambda_builders/workflows/python_pip/actions.py", line 54, in execute
  File "aws_lambda_builders/workflows/python_pip/packager.py", line 156, in build_dependencies
  File "aws_lambda_builders/workflows/python_pip/packager.py", line 258, in build_site_packages
  File "aws_lambda_builders/workflows/python_pip/packager.py", line 282, in _download_dependencies
  File "aws_lambda_builders/workflows/python_pip/packager.py", line 365, in _download_all_dependencies
  File "aws_lambda_builders/workflows/python_pip/packager.py", line 717, in download_all_dependencies
aws_lambda_builders.workflows.python_pip.packager.NoSuchPackageError: Could not satisfy the requirement: requests

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "aws_lambda_builders/workflow.py", line 301, in run
  File "aws_lambda_builders/workflows/python_pip/actions.py", line 57, in execute
aws_lambda_builders.actions.ActionFailedError: Could not satisfy the requirement: requests
2022-07-13 11:21:01,121 | Exception raised during the execution

Build Failed
2022-07-13 11:21:01,122 | Failed to sync infra. Code sync is paused until template/stack is fixed.
Traceback (most recent call last):
  File "aws_lambda_builders/workflows/python_pip/actions.py", line 54, in execute
  File "aws_lambda_builders/workflows/python_pip/packager.py", line 156, in build_dependencies
  File "aws_lambda_builders/workflows/python_pip/packager.py", line 258, in build_site_packages
  File "aws_lambda_builders/workflows/python_pip/packager.py", line 282, in _download_dependencies
  File "aws_lambda_builders/workflows/python_pip/packager.py", line 365, in _download_all_dependencies
  File "aws_lambda_builders/workflows/python_pip/packager.py", line 717, in download_all_dependencies
aws_lambda_builders.workflows.python_pip.packager.NoSuchPackageError: Could not satisfy the requirement: requests

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "aws_lambda_builders/workflow.py", line 301, in run
  File "aws_lambda_builders/workflows/python_pip/actions.py", line 57, in execute
aws_lambda_builders.actions.ActionFailedError: Could not satisfy the requirement: requests

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "samcli/lib/build/app_builder.py", line 760, in _build_function_in_process
  File "aws_lambda_builders/builder.py", line 164, in build
  File "aws_lambda_builders/workflow.py", line 95, in wrapper
  File "aws_lambda_builders/workflow.py", line 308, in run
aws_lambda_builders.exceptions.WorkflowFailedError: PythonPipBuilder:ResolveDependencies - Could not satisfy the requirement: requests

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "samcli/commands/build/build_context.py", line 248, in run
  File "samcli/lib/build/app_builder.py", line 221, in build
  File "samcli/lib/build/build_strategy.py", line 358, in build
  File "samcli/lib/build/build_strategy.py", line 79, in build
  File "samcli/lib/build/build_strategy.py", line 365, in _build_functions
  File "samcli/lib/build/build_strategy.py", line 380, in _run_builds_async
  File "samcli/lib/utils/async_utils.py", line 131, in run_async
  File "samcli/lib/utils/async_utils.py", line 90, in run_given_tasks_async
  File "asyncio/base_events.py", line 587, in run_until_complete
  File "samcli/lib/utils/async_utils.py", line 58, in _run_given_tasks_async
  File "concurrent/futures/thread.py", line 57, in run
  File "samcli/lib/build/build_strategy.py", line 391, in build_single_function_definition
  File "samcli/lib/build/build_strategy.py", line 530, in build_single_function_definition
  File "samcli/lib/build/build_strategy.py", line 424, in build_single_function_definition
  File "samcli/lib/build/build_strategy.py", line 171, in build_single_function_definition
  File "samcli/lib/build/app_builder.py", line 668, in _build_function
  File "samcli/lib/build/app_builder.py", line 763, in _build_function_in_process
samcli.lib.build.exceptions.BuildError: PythonPipBuilder:ResolveDependencies - Could not satisfy the requirement: requests

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "samcli/lib/sync/watch_manager.py", line 190, in _execute_infra_sync
  File "samcli/lib/sync/watch_manager.py", line 142, in _execute_infra_context
  File "samcli/commands/build/build_context.py", line 308, in run
samcli.commands.exceptions.UserException: PythonPipBuilder:ResolveDependencies - Could not satisfy the requirement: requests
2022-07-13 11:21:01,127 | No Parameters detected in the template
2022-07-13 11:21:01,138 | There is no customer defined id or cdk path defined for resource HelloWorldFunction, so we will use the resource logical id as the resource id
2022-07-13 11:21:01,138 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical id as the resource id
2022-07-13 11:21:01,138 | 0 stacks found in the template

Expected result:

I expected the SAM application to sync, as described in Getting started with AWS SAM Accelerate.

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

  1. OS: Ubuntu 20.04
  2. SAM CLI version: 1.53.0
  3. AWS region: us-east-1

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jfusscommented, Jul 14, 2022

@dgard1981 That is good to hear! I am going to leave this open for now and assign to myself so I have a reminder to see what we can improve in the output here. I thought we surface pip details but this is something we should improve so others aren’t stuck wondering as well.

0reactions
adammabroukcommented, Sep 8, 2022

I think I’m experiencing the same problem with sam build --parallel and it seems to behave randomly, in the beginning it was rare but recently it started to be very often ( 2 out of each 5 builds fail ).

I get this message when it fails :

Running PythonPipBuilder:CopySource

Build Failed
Error: PythonPipBuilder:ResolveDependencies - WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/download.py", line 135, in run
    resolver.resolve(requirement_set)
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 265, in _get_abstract_dist_for
    return self.preparer.prepare_editable_requirement(req)
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 554, in prepare_editable_requirement
    abstract_dist = _get_prepared_distribution(
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 95, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/usr/lib/python3/dist-packages/pip/_internal/distributions/sdist.py", line 40, in prepare_distribution_metadata
    self.req.prepare_metadata()
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 568, in prepare_metadata
    self._set_requirement()
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 386, in _set_requirement
    if isinstance(parse_version(self.metadata["Version"]), Version):
  File "/usr/share/python-wheels/packaging-20.3-py2.py3-none-any.whl/packaging/version.py", line 56, in parse
    return Version(version)
  File "/usr/share/python-wheels/packaging-20.3-py2.py3-none-any.whl/packaging/version.py", line 275, in __init__
    match = self._regex.search(version)
TypeError: expected string or bytes-like object

Below is a list of all the libraries required across all my lambdas ( In case you can identify if the problem comes from a specific one )

dataclasses-json==0.5.2
pytest==6.1.2
numpy==1.20.1
boto3==1.16.25
moto==1.3.16
pytest-mock==3.5.1
requests-mock==1.8.0
pandas==1.3.4
opencv-python-headless==4.5.5.62
pillow==9.0.1
pycrypto==2.6.1
aiohttp==3.8.1
aiohttp-retry==2.5.2
requests==2.25.1

These are my environment details:

  • OS: WSL Ubuntu 20.04
  • SAM CLI version: 1.53.0
  • Python version : 3.8
  • Pip Version : 22.2.2
Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS SAM Accelerate fails to resolve dependencies when ...
The problem is that I use an AWS BuildArtifact feed, so any sam build or sam sync action will try and pull packages...
Read more >
Accelerating serverless development with AWS SAM Accelerate
The sam build command verifies that the dependencies have not changed. There is no need to download them again so it builds only...
Read more >
terraform-aws-modules/lambda/aws
Terraform module, which takes care of a lot of AWS Lambda/serverless tasks (build dependencies, packages, updates, deployments) in countless ...
Read more >
Tutorial: Deploying a Hello World application - 亚马逊云科技
Amazon SAM CLI error: "Failed to create managed resources: Unable to locate credentials" ... This means that you have not set up Amazon...
Read more >
iOS 15, accelerate module, armv7, Xcode 13 - Apple Developer
If this error is due to kingfisher then you can try below approach. In order to resolve this issue I tried by changing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found