AttributeError: module ‘collections’ has no attribute ‘MutableMapping’

We Are Going To Discuss About AttributeError: module ‘collections’ has no attribute ‘MutableMapping’. So lets Start this Python Article.

AttributeError: module ‘collections’ has no attribute ‘MutableMapping’

  1. How to solve AttributeError: module 'collections' has no attribute 'MutableMapping'

    There are some Libraries aren't fully compatible with 3.10 to the time pf writing this answer
    You can downgrade to 3.8 or 3.9 for now and it will work seamlessly
    you can find all version for python here
    choose your most suitable version

  2. AttributeError: module 'collections' has no attribute 'MutableMapping'

    There are some Libraries aren't fully compatible with 3.10 to the time pf writing this answer
    You can downgrade to 3.8 or 3.9 for now and it will work seamlessly
    you can find all version for python here
    choose your most suitable version

Solution 1

There are some Libraries aren’t fully compatible with 3.10 to the time pf writing this answer

You can downgrade to 3.8 or 3.9 for now and it will work seamlessly

you can find all version for python here

choose your most suitable version

Original Author Mohamed Arafa Of This Content

Solution 2

The question already seems to have a solution but for better understanding of the problem, in python 3.10, the attribute MutableMapping from the module collections have been removed.
In your case, /usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/pyparsing.py uses the MutableMapping attribute of collections.

As a backward compatibility, the attribute has been moved to collections.abc .
So a dirty hack would be to replace all collections.MutableMapping to collections.abc.MutableMapping

An example :

import collections 
if sys.version_info.major == 3 and sys.version_info.minor >= 10

    from collections.abc import MutableMapping
else 
    from collections import MutableMapping

Original Author Just Khaithang Of This Content

Solution 3

just update requests library version to 2.27.1

use :

sudo apt-get install python-requests==2.27.1

Original Author Amir Of This Content

Solution 4

In my case, upgrading the following packages worked on Windows 11:

pip install --upgrade pip
pip install --upgrade wheel
pip install --upgrade setuptools
pip install --upgrade requests

I hope this helps

Original Author Kloniphani Maxakadzi Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment