Search code examples
pythonpython-3.xaws-lambdabotocorepython-3.12

ERROR - Runtime.ImportModuleError: Unable to import module 'main': No module named 'botocore.vendored.six.moves'


I am developing a lambda project using Python Version 3.12 as a programming language. I developed a simple API and when I run the project locally it shows the following error:

START RequestId: f4eac928-9658-44f0-9193-46bb4162f297 Version: $LATEST
LAMBDA_WARNING: Unhandled exception. The most likely cause is an issue in the function code. However, in rare cases, a Lambda runtime update can cause unexpected function behavior. For functions using managed runtimes, runtime updates can be triggered by a function change, or can be applied automatically. To determine if the runtime has been updated, check the runtime version in the INIT_START log entry. If this error correlates with a change in the runtime version, you may be able to mitigate this error by temporarily rolling back to the previous runtime version. For more information, see https://docs.aws.amazon.com/lambda/latest/dg/runtimes-update.html
[ERROR] Runtime.ImportModuleError: Unable to import module 'main': No module named 'botocore.vendored.six.moves'
Traceback (most recent call last):
END RequestId: 064be081-c61f-4494-ab47-ee1382c83196
REPORT RequestId: 064be081-c61f-4494-ab47-ee1382c83196  Init Duration: 0.09 ms  Duration: 370.09 ms     Billed Duration: 371 ms Memory Size: 128 MB     Max Memory Used: 128 MB
{"errorMessage": "Unable to import module 'main': No module named 'botocore.vendored.six.moves'", "errorType": "Runtime.ImportModuleError", "requestId": "064be081-c61f-4494-ab47-ee1382c83196", "stackTrace": []}

I've updated boto3, botocore and awscli:

pip install --upgrade boto3
pip install --upgrade botocore 
pip install --upgrade awscli

But it still shows the same error mentioned above.

Can someone help me?

Sorry for my English, I used Google Translate


Solution

  • The Amazon resource (ARN) was at version 3.8. I updated the ARN to version 3.12.