aws-sam-cli icon indicating copy to clipboard operation
aws-sam-cli copied to clipboard

Error: PythonPipBuilder:ResolveDependencies failed

Open sowmyapallapothu opened this issue 3 years ago • 8 comments

Hi I am trying to build a lambda custom resource within the yaml file, however since the lambda code has dependencies like python libraries, wheels, and running through codebuild it is looking for build dependencies. I already tried using commands like sam build --use-container , /root/.pyenv/versions/3.8.13/bin/python3.8 -m pip install --upgrade pip & pip install wheel commands within the buildspec file. The codebuild phase is still failing with below error

Final incompatible: {charset-normalizer==3.0.1(wheel)}

212 | Final missing wheels: {charset-normalizer==3.0.1(wheel)} 213 | PythonPipBuilder:ResolveDependencies failed 214 | Traceback (most recent call last): 215 | File "/var/lang/pipx/venvs/aws-lambda-builders/lib/python3.8/site-packages/aws_lambda_builders/workflows/python_pip/actions.py", line 39, in execute 216 | package_builder.build_dependencies( 217 | File "/var/lang/pipx/venvs/aws-lambda-builders/lib/python3.8/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 137, in build_dependencies 218 | self._dependency_builder.build_site_packages(requirements_path, artifacts_dir_path, scratch_dir_path) 219 | File "/var/lang/pipx/venvs/aws-lambda-builders/lib/python3.8/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 207, in build_site_packages 220 | raise MissingDependencyError(packages_without_wheels) 221 | aws_lambda_builders.workflows.python_pip.packager.MissingDependencyError: {charset-normalizer==3.0.1(wheel)} 222 |   223 | During handling of the above exception, another exception occurred: 224 |   225 | Traceback (most recent call last): 226 | File "/var/lang/pipx/venvs/aws-lambda-builders/lib/python3.8/site-packages/aws_lambda_builders/workflow.py", line 269, in run 227 | action.execute() 228 | File "/var/lang/pipx/venvs/aws-lambda-builders/lib/python3.8/site-packages/aws_lambda_builders/workflows/python_pip/actions.py", line 45, in execute 229 | raise ActionFailedError(str(ex)) 230 | aws_lambda_builders.actions.ActionFailedError: {charset-normalizer==3.0.1(wheel)} 231 | Builder workflow failed 232 | Traceback (most recent call last): 233 | File "/var/lang/pipx/venvs/aws-lambda-builders/lib/python3.8/site-packages/aws_lambda_builders/workflows/python_pip/actions.py", line 39, in execute 234 | package_builder.build_dependencies( 235 | File "/var/lang/pipx/venvs/aws-lambda-builders/lib/python3.8/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 137, in build_dependencies 236 | self._dependency_builder.build_site_packages(requirements_path, artifacts_dir_path, scratch_dir_path) 237 | File "/var/lang/pipx/venvs/aws-lambda-builders/lib/python3.8/site-packages/aws_lambda_builders/workflows/python_pip/packager.py", line 207, in build_site_packages 238 | raise MissingDependencyError(packages_without_wheels) 239 | aws_lambda_builders.workflows.python_pip.packager.MissingDependencyError: {charset-normalizer==3.0.1(wheel)} 240 |   241 | During handling of the above exception, another exception occurred: 242 |   243 | Traceback (most recent call last): 244 | File "/var/lang/pipx/venvs/aws-lambda-builders/lib/python3.8/site-packages/aws_lambda_builders/workflow.py", line 269, in run 245 | action.execute() 246 | File "/var/lang/pipx/venvs/aws-lambda-builders/lib/python3.8/site-packages/aws_lambda_builders/workflows/python_pip/actions.py", line 45, in execute 247 | raise ActionFailedError(str(ex)) 248 | aws_lambda_builders.actions.ActionFailedError: {charset-normalizer==3.0.1(wheel)} 249 |   250 | During handling of the above exception, another exception occurred: 251 |   252 | Traceback (most recent call last): 253 | File "/var/lang/pipx/venvs/aws-lambda-builders/lib/python3.8/site-packages/aws_lambda_builders/main.py", line 117, in main 254 | builder.build( 255 | File "/var/lang/pipx/venvs/aws-lambda-builders/lib/python3.8/site-packages/aws_lambda_builders/builder.py", line 125, in build 256 | return workflow.run() 257 | File "/var/lang/pipx/venvs/aws-lambda-builders/lib/python3.8/site-packages/aws_lambda_builders/workflow.py", line 76, in wrapper 258 | func(self, *args, **kwargs) 259 | File "/var/lang/pipx/venvs/aws-lambda-builders/lib/python3.8/site-packages/aws_lambda_builders/workflow.py", line 276, in run 260 | raise WorkflowFailedError(workflow_name=self.NAME, action_name=action.NAME, reason=str(ex)) 261 | aws_lambda_builders.exceptions.WorkflowFailedError: PythonPipBuilder:ResolveDependencies - {charset-normalizer==3.0.1(wheel)} 262 | Build inside container returned response {"jsonrpc": "2.0", "id": 1, "error": {"code": 400, "message": "PythonPipBuilder:ResolveDependencies - {charset-normalizer==3.0.1(wheel)}"}} 263 |   264 | Build Failed 265 | Sending Telemetry: {'metrics': [{'commandRun': {'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'duration': 41777, 'exitReason': 'BuildError', 'exitCode': 1, 'requestId': '9d527dd0-0a0c-4dca-90ad-7cf5f02ab672', 'installationId': '14ae294c-e1e1-4ec4-ac6a-ae19e9aa3b0a', 'sessionId': 'fd6b1823-01d7-4c81-a685-86799b736885', 'executionEnvironment': 'CLI', 'pyversion': '3.8.13', 'samcliVersion': '0.41.0'}}]} 266 | Telemetry response: 200 267 | Error: PythonPipBuilder:ResolveDependencies - {charset-normalizer==3.0.1(wheel)} 268 | Makefile:61: recipe for target 'out/sam-build/template.yaml' failed 269 | make: *** [out/sam-build/template.yaml] Error

sowmyapallapothu avatar Jan 19 '23 16:01 sowmyapallapothu

Bumped on this same issue with ADF framework. It use sam under the hood to deploy some components.

mikahaht avatar Jan 23 '23 12:01 mikahaht

Hi @sowmyapallapothu , thanks for bringing this to our attention! Could you please provide more details and steps to reproduce, including relevant files or snippets if possible? With just the error message, it won't be very easy to diagnose the issue.

It seems like a dependency problem. Have you tried pip installing the dependencies directly, in the same environment that the codebuild job runs? If that fails, then that would indicate there might be an issue with your dependencies themselves.

torresxb1 avatar Jan 23 '23 18:01 torresxb1

I also got the same issue.

I am using Python 2.7.18 Also tried with Python 3.8.0

Build using sam and getting the below error: Build command: GOOS=linux sam build --parallel -b <buid_dir> --template-file <template_file>

Error:

Running PythonPipBuilder:ResolveDependencies
Build Failed
Error: PythonPipBuilder:ResolveDependencies - {charset-normalizer==3.0.1(wheel)}

narasimman-elu avatar Jan 24 '23 10:01 narasimman-elu

My issue got solved after updating to the latest the greatest version as of now which is SAM CLI, version 1.70.1

narasimman-elu avatar Jan 24 '23 12:01 narasimman-elu

Hi @torresxb1 I have tried installing pip dependencies directly, in the same environment that the codebuild job runs. Still faced the same issue. However after upgrading the sam cli version to 1.70.01 the dependencies issue was resolved.

@narasimman-elu Thank you, it worked by upgrading the sam cli version to 1.70.1

sowmyapallapothu avatar Jan 25 '23 15:01 sowmyapallapothu

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Jan 25 '23 15:01 github-actions[bot]

Hi @narasimman-elu and @sowmyapallapothu , thanks for the updates! For my own investigation, could you let me know which version was causing the failures before you updated?

torresxb1 avatar Jan 25 '23 22:01 torresxb1

I got this error with

"aws-lambda-builders": {
    "version": "==0.8.0"
},
"aws-sam-cli": {
    "version": "==0.47.0"
},
"aws-sam-translator": {
    "version": "==1.22.0"
},
"awscli": {
    "version": "==1.18.37"
},

and it worked when I used

"aws-lambda-builders": {
    "version": "==1.31.0"
},
"aws-sam-cli": {
    "version": "==1.84.0"
},
"aws-sam-translator": {
    "version": "==1.66.0"
},
"awscli": {
    "version": "==1.27.135"
},

benbridts avatar May 17 '23 09:05 benbridts