0

The Folding@Home control program named FAHControl (downloaded from here) won't launch with this Python error:

$ FAHControl

Traceback (most recent call last):
  File "/usr/bin/FAHControl", line 25, in <module>
    from fah import FAHControl, load_fahcontrol_db
  File "/usr/lib/python3/dist-packages/fah/__init__.py", line 25, in <module>
    from . import util
  File "/usr/lib/python3/dist-packages/fah/util/__init__.py", line 24, in <module>
    from .OrderedDict import *
  File "/usr/lib/python3/dist-packages/fah/util/OrderedDict.py", line 23, in <module>
    from collections import MutableMapping as DictMixin
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

I am on Linux Mint 21.3 Cinnamon (which is based on Ubuntu 22.04). Is there a solution?

1 Answer 1

0

What happened and when

There appears to be a change in the 3.10+ Python version. But the solution is actually very simple, if you do not care for history lesson, jump to the below solution.

As stated in the Python manual:

collections.abc or Abstract Base Classes for Containers are new in version 3.3 and formerly, this module was part of the collections module. On 3.9 version of the same manual, I found information about when it was deprecated and when it was removed for programmers to have to adjust their code:

Deprecated since version 3.3, will be removed in version 3.10: Moved Collections Abstract Base Classes to the collections.abc module. For backwards compatibility, they continue to be visible in this module through Python 3.9.


Straightforward solution

Just edit the following file as root with your favorite text editor:

/usr/lib/python3/dist-packages/fah/util/OrderedDict.py

Change the line 23:

from this

from collections import MutableMapping as DictMixin

to this

from collections.abc import MutableMapping as DictMixin

Save and try again.

FAHControl now launches on my side. The solution has been fully tested and working (on my system at least).


Some screenshots of working both FAHControl and FAHClient (http://127.0.0.1:7396/):

FAHControl (click to enlarge):

FAHControl

FAHClient (click to enlarge):

FAHClient

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .