How to Fix ImportError: cannot import name ‘docevents’ from ‘botocore.docs.bcdoc’ in AWS

Diagram of cannot import name docevents from botocore.docs.bcdoc in AWS

Diagram

ImportError: cannot import name ‘docevents’ from ‘botocore.docs.bcdoc’ error occurs when the “version of the botocore library installed on your system is incompatible with the version of the AWS CLI that CodeBuild is using.”

To fix the ImportError: cannot import name ‘docevents’ from ‘botocore.docs.bcdoc’ error, “upgrade the version of the AWS CLI that CodeBuild is using or downgrade the version of the botocore library that is installed on your system.

The current version of “AWSCLI” is 1.29.20.

AWSCLI

The current version of Botocore is 1.31.0.

Botocore

Solution 1

If you are using the AWS CLI that is installed by default on your system, you can “upgrade the CLI” using this command: 

pip install --upgrade awscli

To downgrade the botocore library version installed on your system, you can use the “pip install botocore==1.17.63” to install a specific library version.

pip install botocore==1.17.63

Solution 2

If you are still facing the issue, then you should upgrade all the libraries to their latest version using these commands:

pip install --upgrade awscli

pip install --upgrade botocore

pip install --upgrade boto3

Once you fix the version incompatibility, the ImportError should be solved, and CodeBuild can generate documentation for your AWS services.

Solution 3

If the upgrade doesn’t solve the problem, it might be due to a corrupted or incomplete installation. You can try reinstalling botocore using pip:

pip uninstall botocore

pip install botocore

I hope these solutions will help you fix the error!

Similar posts

botocore.exceptions.NoCredentialsError: Unable to locate credentials

AttributeError: ‘s3’ object has no attribute ‘object’

AttributeError: ‘s3’ object has no attribute ‘load_string’

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.