With a python file that is just:
from flask_socketio import SocketIO
I get the error:
> python .\app.py
Traceback (most recent call last):
File "C:\{...}\server\app.py", line 127, in <module>
from flask_socketio import SocketIO
File "C:\{...}\Python310\lib\site-packages\flask_socketio\__init__.py", line 9, in <module>
from socketio import socketio_manage # noqa: F401
File "C:\{...}\Python310\lib\site-packages\socketio\__init__.py", line 9, in <module>
from .zmq_manager import ZmqManager
File "C:\{...}\Python310\lib\site-packages\socketio\zmq_manager.py", line 5, in <module>
import eventlet.green.zmq as zmq
File "C:\{...}\Python310\lib\site-packages\eventlet\__init__.py", line 17, in <module>
from eventlet import convenience
File "C:\{...}\Python310\lib\site-packages\eventlet\convenience.py", line 7, in <module>
from eventlet.green import socket
File "C:\{...}\Python310\lib\site-packages\eventlet\green\socket.py", line 21, in <module>
from eventlet.support import greendns
File "C:\{...}\Python310\lib\site-packages\eventlet\support\greendns.py", line 79, in <module>
setattr(dns, pkg, import_patched('dns.' + pkg))
File "C:\{...}\Python310\lib\site-packages\eventlet\support\greendns.py", line 61, in import_patched
return patcher.import_patched(module_name, **modules)
File "C:\{...}\Python310\lib\site-packages\eventlet\patcher.py", line 132, in import_patched
return inject(
File "C:\{...}\Python310\lib\site-packages\eventlet\patcher.py", line 109, in inject
module = __import__(module_name, {}, {}, module_name.split('.')[:-1])
File "C:\{...}\Python310\lib\site-packages\dns\namedict.py", line 35, in <module>
class NameDict(collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'
I saw in other threads that collections.MutableMapping
has changed to collections.abc.MutableMapping
in python >=3.1. I have tried the following solutions to no avail:
pip install --upgrade pip
pip install --upgrade wheel
pip install --upgrade setuptools
pip install --upgrade requests
pip install flask-socketio
I tried to reinstall the eventlet dependency with upgrade:
pip install --upgrade eventlet
Requirement already satisfied: eventlet in c:\...\python\python310\lib\site-packages (0.33.3)
Requirement already satisfied: greenlet>=0.3 in c:\...\python\python310\lib\site-packages (from eventlet) (2.0.2)
Requirement already satisfied: dnspython>=1.15.0 in c:\...\python\python310\lib\site-packages (from eventlet) (1.16.0)
Requirement already satisfied: six>=1.10.0 in c:\...\python\python310\lib\site-packages (from eventlet) (1.16.0)
None of these options work. How should I fix this error?
The problem is with dnspython the latest version of dnspython does use collections.abc.MutableMapping
, so you need to upgrade it
pip install --upgrade dnspython