Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Error: AttributeError: module 'collections' has no attribute 'MutableMapping' #1

Open
Chris-fullerton opened this issue Jun 19, 2023 · 0 comments

Comments

@Chris-fullerton
Copy link

Chris-fullerton commented Jun 19, 2023

https://stackoverflow.com/a/71902541/20119529

The attribute MutableMapping from the module collections got moved into collections.abc in python3.10.

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.

If you can acces the source code, replace all collections.MutableMapping with 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

Python 3.10.11 (main, Apr 20 2023, 13:58:42) [Clang 14.0.6 ] on darwin

Occured when trying to import ProcessLocal by from pytutils.mappings import ProcessLocal:

Traceback (most recent call last):
  File "/Users/christopherchang/TEST/python_test/test.py", line 1, in <module>
    from pytutils.mappings import ProcessLocal
  File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/site-packages/pytutils/mappings.py", line 23, in <module>
    class ProxyMutableMapping(collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'
@Chris-fullerton Chris-fullerton changed the title AttributeError: module 'collections' has no attribute 'MutableMapping' Import Error: AttributeError: module 'collections' has no attribute 'MutableMapping' Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant