close

[Solved] ImportError: cannot import name ‘docevents’ from ‘botocore.docs.bcdoc’ in AWS CodeBuild

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error ImportError: cannot import name ‘docevents’ from ‘botocore.docs.bcdoc’ in AWS CodeBuild in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ImportError: cannot import name ‘docevents’ from ‘botocore.docs.bcdoc’ in AWS CodeBuild Error Occurs?

Today I get the following error ImportError: cannot import name ‘docevents’ from ‘botocore.docs.bcdoc’ in AWS CodeBuild in Python.

How To Solve ImportError: cannot import name ‘docevents’ from ‘botocore.docs.bcdoc’ in AWS CodeBuild Error ?

  1. How To Solve ImportError: cannot import name 'docevents' from 'botocore.docs.bcdoc' in AWS CodeBuild Error ?

    To Solve ImportError: cannot import name 'docevents' from 'botocore.docs.bcdoc' in AWS CodeBuild Error Was getting the same error on Ubuntu 20.04, fixed by replacing pip3 with pip – sudo python3 -m pip install awscli==1.18.105 and sudo python3 -m pip install botocore==1.17.28 

Solution 1

Reading this GitHub issue #2596. i fixed my error.

Just before the PRE_BUILD section, I added this line to my buildspec-cd.yml file:

pip3 install –upgrade awscli

install:
    commands:
      - pip3 install awsebcli --upgrade
      - eb --version
      - pip3 install --upgrade awscli

    pre_build:
      commands:
      - AWS_REGION=${AWS_DEFAULT_REGION}
      - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
      - IMAGE_VERSION=${COMMIT_HASH}
      ...

Solution 2

For me it’s a version issue. So, I fixed it with below versions:

  1. aws-cli/1.18.105

Command: sudo python3 -m pip3 install awscli==1.18.105

  1. botocore/1.17.28

Command: sudo python3 -m pip3 install botocore==1.17.28

Solution 3

Was getting the same error on Ubuntu 20.04, fixed by replacing pip3 with pip – sudo python3 -m pip install awscli==1.18.105 and sudo python3 -m pip install botocore==1.17.28 

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment