flask-script only works with ancient flask
Expected behaviour
A working Flask example, to help noobs like me...
Actual behaviour
ModuleNotFoundError: No module named 'flask._compat'
What are the steps to reproduce this issue?
git clone https://github.com/python-social-auth/social-examples
cd social-examples/example-flask
python3 manage.py
Any logs, error output, etc?
Traceback (most recent call last):
File "/mnt/home/michael/docs/dev/social-examples/example-flask/manage.py", line 3, in <module>
from flask_script import Manager, Server, Shell
File "/home/michael/.local/lib/python3.11/site-packages/flask_script/__init__.py", line 15, in <module>
from flask._compat import text_type
ModuleNotFoundError: No module named 'flask._compat'
Any other comments?
Expand the issue with any details you find appropriate to solve or reproduce it.
I have these installed.
Flask 2.2.2
Flask-Breadcrumbs 0.5.1
Flask-Login 0.6.2
flask-menu 1.0.1
Flask-Migrate 4.0.4
Flask-Script 2.0.6
Flask-SQLAlchemy 3.0.3
social-auth-app-flask 1.0.0
social-auth-app-flask-sqlalchemy 1.0.1
social-auth-core 4.5.3
social-auth-storage-sqlalchemy 1.1.0
Also note the warning at the top of https://flask-script.readthedocs.io/en/latest/:
the error you're encountering indicates that the flask_script package is trying to import a module (flask._compat) that no longer exists in the latest versions of Flask. This is likely due to the flask_script package being outdated.
Here are a few ways to resolve this issue:
Update to Flask-Script2: Flask-Script is no longer maintained. A fork called Flask-Script2 is available, which might resolve the issue.
First, uninstall flask_script:
pip uninstall flask_script
Then, install Flask-Script2:
pip install Flask-Script2
Add some necessary chances
pip install Flask-Script2
Wow, I smell LLM.
michael@foo:~/dl$ pip download Flask-Script2
ERROR: Could not find a version that satisfies the requirement Flask-Script2 (from versions: none)
ERROR: No matching distribution found for Flask-Script2
And/or an incompetent attempt at supply chain attack...
Indeed, that comment looks weird. Anyway: https://github.com/python-social-auth/social-examples/pull/50 most likely addresses this issue, but lacks review.