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

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

Open
carlosgmartin opened this issue Apr 9, 2023 · 1 comment

Comments

@carlosgmartin
Copy link

$ 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?

@arvoelke
Copy link
Owner

arvoelke commented Apr 10, 2023

The idea has been that nengo 3.0+ and its officially supported libraries would subsume the main use cases for nengolib. I'm currently open to accepting simple patches for nengolib but if there is something in here that you can't find in the official nengo ecosystem it would be better to open up a request for support on the Nengo forum or a GitHub issue for the relevant Nengo library.

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

2 participants