Boto3: ImportError: cannot import name 'docevents' release 1.15.0

Created on 17 Sep 2020  路  43Comments  路  Source: boto/boto3

Describe the bug
aws help command not functioning in release https://github.com/boto/boto3/releases/tag/1.15.0
I am using miniconda3 python runtime environment with the python implementation of AWS CLI. The error originally occurred on our CI pipeline.

Steps to reproduce

  • pip install "boto3==1.15.0"
  • aws help
    Traceback (most recent call last):
    File "C:\Users\X\Miniconda3\Scripts\aws.cmd", line 50, in
    import awscli.clidriver
    File "C:\Users\X\Miniconda3\lib\site-packages\awscli\clidriver.py", line 36, in
    from awscli.help import ProviderHelpCommand
    File "C:\Users\X\Miniconda3\lib\site-packages\awscli\help.py", line 23, in
    from botocore.docs.bcdoc import docevents
    ImportError: cannot import name 'docevents'

Expected behavior
aws help is displayed as when boto3 1.14.63 is installed

Most helpful comment

I'm curious how many workflows broke because of this change...

All 43 comments

Looks like docevents was removed in botocore 1.18.0 https://github.com/boto/botocore/commit/dd24dd1b2ee8654ae0cf6aebce4a2f50ea7d75f5#diff-cebf7e5767458186d20a75e5390de4de

Upgrading awscli to >=1.18.140 should fix this: https://github.com/aws/aws-cli/pull/5538

Thanks for the quick update, @gregory-lyons! That's correct, we released botocore 1.18.0 today which removed AWS CLI specific doc files. Those were already migrated to the CLI in version 1.18.140 (aws/aws-cli#5538) so the CLI no longer depends on botocore for them.

All versions of the CLI released prior to 1.18.141 explicitly require a version of botocore < 1.18.0. It looks like pip doesn't respect this because dependency resolution isn't released yet. When boto3 1.15.0 is installed, pip is uninstalling the required dependencies for the CLI. We're currently evaluating options, but I think the immediate fix is to be updating the CLI in line with boto3.

Thank you, I will upgrade awscli

I'm curious how many workflows broke because of this change...

All our workflows have now broken because of this as well

aws glue python shell stop working after this update.

As workaround for AWS Glue is add botocore = "<1.18.0"

Our prod deploy broke because of this today, it appears. Thanks for opening this!

All our pipelines were broken as Codebuild images use a CLI < 1.18.140...

Solved by forcing an upgrade on awscli

This broken our codebuild jobs too 馃槥

Broke all my deploys too. Upgrading awscli fixed them. Thanks for the info!

in CodeBuild, update the aws cli like so for the agent/node, as a workaround. _line # 11_

image

Can confirm that this change broke workflows all across my company on multiple continents.

All our workflows have now broken because of this change

We have the same issue for our CodeBuild projects

We have the same issue trying to launch Glue Zeppelin Notebook Servers.

Same issue here, thanks for raising this and lead me to the solution.

Same issue and thanks for the solution pip3 install awscli fix our issue

image

this upgrade broke all our pipelines in all environments. we figured out that this was due to boto3 release and we downgraded boto3 to a stable release . While installing boto3 we used pip install boto3==1.14.62. And this solved the problem .

same here, some pipelines broken becasue of this.

The YUM package on Amazon Linux 2 is impacted by this.

$ sudo yum reinstall awscli
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package awscli.noarch 0:1.18.107-1.amzn2.0.1 will be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================
 Package               Arch                  Version                             Repository                 Size
=================================================================================================================
Reinstalling:
 awscli                noarch                1.18.107-1.amzn2.0.1                amzn2-core                2.0 M

Transaction Summary
=================================================================================================================
Reinstall  1 Package

Total download size: 2.0 M
Installed size: 7.6 M
Is this ok [y/d/N]: y
Downloading packages:
awscli-1.18.107-1.amzn2.0.1.noarch.rpm                                                    | 2.0 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : awscli-1.18.107-1.amzn2.0.1.noarch                                                            1/1
  Verifying  : awscli-1.18.107-1.amzn2.0.1.noarch                                                            1/1

Installed:
  awscli.noarch 0:1.18.107-1.amzn2.0.1

Complete!
i-06a25febbba71da48 [ec2-user@dp-fe-int1 tmp]$ sudo aws s3 cp s3://***redacted**/assets/ansible/current-daily/master/ansible-bootstrap.sh /var/local/ansible/bootstrap
Traceback (most recent call last):
  File "/bin/aws", line 19, in <module>
    import awscli.clidriver
  File "/usr/lib/python2.7/site-packages/awscli/clidriver.py", line 36, in <module>
    from awscli.help import ProviderHelpCommand
  File "/usr/lib/python2.7/site-packages/awscli/help.py", line 23, in <module>
    from botocore.docs.bcdoc import docevents
ImportError: cannot import name docevents

can someone send commands and instructions to fix this issue for production pipelines?

@bonudagar it has been shared a few times in this thread, but for anyone else who might have also missed it, you can upgrade your version of awscli.

pip install --upgrade awscli

See this comment for more details https://github.com/boto/boto3/issues/2596#issuecomment-694508466

Pretty sure this broke the code pipeline for anyone who uses AWS Landing Zone. The build step pulls a new boto version each time, but also uses the AWS CLI and runs on the aws/codebuild/standard:2.0 image which I'm guessing has an older version of the CLI (have to check for the specifics). Not cool though

Same issue here as well. It impacted our boostrapping workflow for our eks worker nodes.

cool, just need to go upgrade a hundred or so repo's on a friday afternoon and a bunch of base images. Who's going to tell my kids they won't see me the rest of the weekend? 馃槩

During Zeppelin notebook server creation, setup_notebook_server.py file is missing. I am assuming this is due to this reason. So, how to solve this one?

This also appears to break the UserData script included in AWS Glue managed Zeppelin Notebooks with Dev Endpoints, as the script fails to run to completion because of this issue.
```bash
aws s3 --region ap-southeast-2 cp --recursive s3://aws-glue-zeppelin-prod-ap-southeast-2/public/setup /home/ec2-user/setup
Traceback (most recent call last):
File "/usr/bin/aws", line 19, in
import awscli.clidriver
File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 33, in
from awscli.help import ProviderHelpCommand
File "/usr/lib/python2.7/dist-packages/awscli/help.py", line 23, in
from botocore.docs.bcdoc import docevents
ImportError: cannot import name docevents

This is also affecting S3 downloads and it's still happening in the last version.

We're having the same issue. Broke our pipeline.

aws glue zeppelin is having same issue, working on a CM upgrade awscli before install boto3

During Zeppelin notebook server creation, setup_notebook_server.py file is missing. I am assuming this is due to this reason. So, how to solve this one?

That's true, because awscli is not working after install boto3, then it fails to download dependent scripts from s3. I am fixing it

During Zeppelin notebook server creation, setup_notebook_server.py file is missing. I am assuming this is due to this reason. So, how to solve this one?

we have to do a hotfix in prod in all regions, user cannot solve it directly

This also affects Ubuntu when installing awscli from the Ubuntu repository (current version is 1.18.69-1ubuntu0.16.04.1). Downgrading (or uninstalling) boto3 allows aws to start working again.

These doesn't look like will be fixed soon by package maintainers... which is... shameful.

If you need to to fix this you might want to pin these versions

botocore==1.17.63
awscli==1.18.140 
boto3==1.14.63

I hope this save you some time, while we wait for these to be addressed

Also broken in alpine linux as the latest version available is 1.18.55-r0

https://pkgs.alpinelinux.org/package/edge/community/x86_64/aws-cli

Is There anything we are doing to make sure these kind of errors does not happens again?
What about CI tests ?

I see the solution to the issue being posted as:

- pip install --upgrade awscli

Our aws pro-services person had us update the BuildSpec in the CI pipeline to:

- pip install --upgrade --user awscli

Just curious why he had me use the --user switch. Would I not want this installed/updated in my system directory, as opposed to the home directory of the buildspec?

Also broken in alpine linux as the latest version available is 1.18.55-r0

https://pkgs.alpinelinux.org/package/edge/community/x86_64/aws-cli

@lloydpick

https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/12829

If you're going to use alpine, I recommend learning how to update packages. It took literally 2 minutes to create that MR and they are usually merged within a couple hours.

These doesn't look like will be fixed soon by package maintainers... which is... shameful.

If you need to to fix this you might want to pin these versions

botocore==1.17.63
awscli==1.18.140 
boto3==1.14.63

I hope this save you some time, while we wait for these to be addressed

Our build was successful after explicitly specify the below in the requirements

botocore==1.18.14
awscli==1.18.155
boto3==1.15.14

Got this after installing awscli using apt in Ubuntu 20.04.
sudo apt purge awscli
sudo pip3 install awscli

helped

But still seems like it shouldn't have been broken in the first place.

Still facing the same issue. Current packages
awscli = 1.18.155 awsebcli = 3.19.2 boto3 = 1.15.14 botocore = 1.18.14

Was this page helpful?
0 / 5 - 0 ratings