ImportError: cannot import name ‘MutableMapping’ from ‘collections’

collections.MutableMapping has been deprecated since Python 3.3, and was officially removed since Python 3.9.

Excerpt from the documentation:

Deprecated since version 3.3, will be removed in version 3.9: Moved
Collections Abstract Base Classes to the collections.abc module.

You can either wait for a Python 3.9-compatible version of awscli to be released, or patch the aws script (under your /usr/local/bin) yourself like this for the time being:

...
import collections
from collections import abc
collections.MutableMapping = abc.MutableMapping
import awscli.clidriver

Leave a Comment