Skip to content

AttributeError: module 'collections' has no attribute 'MutableMapping' #190

@carlosgmartin

Description

@carlosgmartin
$ python3 -c "import nengolib"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/carlos/Library/Python/3.11/lib/python/site-packages/nengolib/__init__.py", line 51, in <module>
    from .connection import Connection
  File "/Users/carlos/Library/Python/3.11/lib/python/site-packages/nengolib/connection.py", line 1, in <module>
    import nengo
  File "/usr/local/lib/python3.11/site-packages/nengo/__init__.py", line 17, in <module>
    from .base import Process
  File "/usr/local/lib/python3.11/site-packages/nengo/base.py", line 7, in <module>
    from nengo.config import SupportDefaultsMixin
  File "/usr/local/lib/python3.11/site-packages/nengo/config.py", line 19, in <module>
    from nengo.params import Default, is_param, iter_params
  File "/usr/local/lib/python3.11/site-packages/nengo/params.py", line 8, in <module>
    from nengo.utils.compat import (int_types, is_array, is_array_like, is_integer,
  File "/usr/local/lib/python3.11/site-packages/nengo/utils/__init__.py", line 18, in <module>
    from . import simulator
  File "/usr/local/lib/python3.11/site-packages/nengo/utils/simulator.py", line 6, in <module>
    from .stdlib import groupby
  File "/usr/local/lib/python3.11/site-packages/nengo/utils/stdlib.py", line 19, in <module>
    class WeakKeyDefaultDict(collections.MutableMapping):
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'MutableMapping'

This was fixed in nengo/nengo@e9a6269 by changing collections.MutableMapping to collections.abc.MutableMapping, but nengolib is pinned to nengo<3.0. Manually upgrading nengo:

$ python3 -m pip install --upgrade nengo

yields another error:

$ python3 -c "import nengolib"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/carlos/Library/Python/3.11/lib/python/site-packages/nengolib/__init__.py", line 53, in <module>
    from .monkeypatch import patch, unpatch
  File "/Users/carlos/Library/Python/3.11/lib/python/site-packages/nengolib/monkeypatch.py", line 3, in <module>
    from nengolib.network import Network
  File "/Users/carlos/Library/Python/3.11/lib/python/site-packages/nengolib/network.py", line 4, in <module>
    from nengolib.stats.ntmdists import ball, sphere
  File "/Users/carlos/Library/Python/3.11/lib/python/site-packages/nengolib/stats/__init__.py", line 38, in <module>
    from .ntmdists import *
  File "/Users/carlos/Library/Python/3.11/lib/python/site-packages/nengolib/stats/ntmdists.py", line 7, in <module>
    from nengo.utils.compat import is_integer
ModuleNotFoundError: No module named 'nengo.utils.compat'

Related:

It looks like these were last edited in December 2019. Will there be any fix in the foreseeable future?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions