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

ImportError: cannot import name 'Mapping' from 'collections' #127

Closed
ryanmrestivo opened this issue Jun 22, 2023 · 9 comments
Closed

ImportError: cannot import name 'Mapping' from 'collections' #127

ryanmrestivo opened this issue Jun 22, 2023 · 9 comments

Comments

@ryanmrestivo
Copy link

ryanmrestivo commented Jun 22, 2023

Description of bug
ImportError: cannot import name 'Mapping' from 'collections' (C:\Python311\Lib\collections_init_.py)

Log Messages
Log messages are in screenshot below. I also face this issue if installing via pip or Python.

Screenshots
Screenshot 2023-06-22 182402

Desktop:
-Windows 10 22621.1848

Additional context
Any information/guidance here would be appreciated! I realize you support 3.7, though this seems relevant.

@orhun
Copy link
Member

orhun commented Jun 23, 2023

It is probably a Python incompatibility related dependency version error. Although we have a lock file, we might still need to pin certain dependencies. Which version of Python did you use?

@ryanmrestivo
Copy link
Author

Hey, thanks for your response -- Python 3.11.4

@orhun
Copy link
Member

orhun commented Jun 23, 2023

Uh, that's a bit problematic. We simply stopped maintaining this project in 3.7 so these kinds of errors are expected. (definitely fixable tho!)

Is there any chance that you can downgrade to 3.7 and try again to see if the error persists? I recommend using a pyenv or rye (experimental) for doing so.

@ryanmrestivo
Copy link
Author

Completely removed python, installed 3.7, new errors haha
Screenshot 2023-06-23 112151

@orhun
Copy link
Member

orhun commented Jun 23, 2023

Oh damn, maybe check out https://stackoverflow.com/questions/71850969/importerror-cannot-import-name-run-with-reloader-from-werkzeug-serving

I'm afraid this issue is about to turn into a wormhole 🪱

@ryanmrestivo
Copy link
Author

ryanmrestivo commented Jun 23, 2023

You were right, it is a wormhole!

werkzeug doesn't like markupsafe 2.1.3... it looks like markupsafe removed soft_unicode which is causing this error. (pallets/markupsafe#304)
I attempted to downgrade to 2.0.1, but werkzeug isn't compatible. Any recommendations on downgrading werkzeug? Or am I off-track?

I appreciate your help!
Screenshot 2023-06-23 113750

@orhun
Copy link
Member

orhun commented Jun 23, 2023

I think the most durable solution would be to support the latest version of all the libraries that are used in the project which means a quite a bit of work. I would say let's go back to the latest Python and focus on somehow solving that error instead of getting stuck in the past.

@ryanmrestivo
Copy link
Author

Ok - Fixed! Steps taken to remediate so far on python 3.11

File "C:\Python311\Lib\site-packages\prompt_toolkit\styles\from_dict.py"

line 9, in
changed "from collections import Mapping" to "from collections.abc import Mapping"

Then upgraded flask_socketio
pip install --upgrade flask_socketio

Thanks!
Screenshot 2023-06-23 144408

@orhun
Copy link
Member

orhun commented Jun 23, 2023

Glad that this is resolved!

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