importerror: cannot import name ‘docevents’ from ‘botocore.docs.bcdoc’

importerror_ cannot import name 'docevents' from 'botocore.docs.bcdoc'

The error importerror: cannot import name ‘docevents’ from ‘botocore.docs.bcdoc’ occurs in AWS build because of awscli version incompatibility.  Since docevents is a module of botocore library which is part of AWSCLI distribution. In this article, we will explore ways to fix the same.

importerror: cannot import name ‘docevents’ from ‘botocore.docs.bcdoc’ ( Cause ) –

The main reason for this error is version conflict for botocore module and awscli. Obviously, a different scenario has different context but the root cause will not differ. Hence the solution will be the same in all scenarios.

 

importerror: cannot import name ‘docevents’ from ‘botocore.docs.bcdoc’ ( Solution ) –

As simple as the cause, The solution is also easier. Let’s see how we will upgrade both packages.

sudo python3 -m pip3 install awscli
sudo python3 -m pip3 install botocore
importerror cannot import name 'docevents' from 'botocore.docs.bcdoc'
importerror cannot import name ‘docevents’ from ‘botocore.docs.bcdoc’

Tips –

1. Sometimes we need to upgrade the pip package manager. It will resolve most of the version conflict for the python version. Conda is also a very popular package manager but the majority is still with pip package manager only. So let’s see how can we upgrade the same.

python3 -m pip install –-upgrade pip

One more important thing is to run this command as a prerequisite to the above commands.

 

2. Usually any pip install command automatically uninstall the previous version. But in some real scenarios, It does not uninstall the previous package. In that case,  we have to manually uninstall the package using the command –

pip uninstall botocore

Now you can try the above command for installing the package botocore module.

Alternative :

If you do not prefer pip or conda package manager, You may use the curl command to update botocore package. Curl command first downloads the code but it will be of zip format. Then we have to first unzip the same. After it, we can install the same package. Let’s see the command –

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

Here We can configure the different URL if there change in any update.

 

Thanks 

Data Science Learner Team

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.

 
Thank you For sharing.We appreciate your support. Don't Forget to LIKE and FOLLOW our SITE to keep UPDATED with Data Science Learner