Problem with python -- missing module

I have previously used CHIRP and am upgrading to the newer python3 version but am encountering several issues. Each time I try to launch the new version I get an error, and have been working through them one at a time (which mostly requires installing a python package not previously installed).
I have, however, hit one that I cannot find the proper fix for.

    File "/home/USERNAME/.local/lib/python3.11/site-packages/attrdict/mapping.py", line 4, in <module>
          from collections import Mapping
      ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib64/python3.11/collections/__init__.py)
      [end of output]

Looking at the collections module installed for the system it does not seem to have the Mapping module as the error states and I cannot figure out how to fix that issue. Does someone with python experience have any suggestions?

I am using pip and installing it as the user, but that particular module (collections) seems to be a system module installed with the python3-libs package.

If you enter python --version, does it report the updated version?

$ python --version
Python 3.11.2

certainly.

I was able to do a work-around by editing the /usr/lib64/python3.11/collections/__init__.py file and adding the following lines.
Note that the error posted was occurring when doing pip install wxpython and it was not pulling in the earlier required modules (which I manually installed), but this one was a system module failure.

In that file noted I added the lines

from _collections_abc import Mapping
from _collections_abc import MutableMapping
from _collections_abc import Sequence

at the top with the rest of the import statements, then I was able to finish the install of wxpython.

I am not sure why I had to explicitly import those modules since the _collections_abc module was imported in its entireity but by making the explicit import wxpython was satisfied and the install completed. I guess since wxpython did not reference the next level of modules it is explained, yet it seems wxpython was not happy.

It seems that changes between python 3.10 and python 3.11 broke wxpython.

1 Like