close

[Solved] flask._compat import text_type ModuleNotFoundError: No module named ‘flask._compat’

Hello Guys, How are you all? Hope You all Are Fine. I am using Flask-Script I get an error when importing Manager. I have installed with pip Flask and Flask-Script. flask._compat import text_type ModuleNotFoundError: No module named ‘flask._compat’ in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How flask._compat import text_type ModuleNotFoundError: No module named ‘flask._compat’ Error Occurs ?

I am using Flask-Script I get an error when importing Manager. I have installed with pip Flask and Flask-Script.

Traceback (most recent call last):
  File "manage.py", line 1, in <module>
    from flask_script import Manager
  File "/home/raul/Proyectos Python/flask_script/venv/lib/python3.8/site-packages/flask_script/__init__.py", line 15, in <module>
    from flask._compat import text_type
ModuleNotFoundError: No module named 'flask._compat'

How To Solve flask._compat import text_type ModuleNotFoundError: No module named ‘flask._compat’ Error ?

  1. How To Solve flask._compat import text_type ModuleNotFoundError: No module named 'flask._compat' Error ?

    To Solve flask._compat import text_type ModuleNotFoundError: No module named 'flask._compat' Error If you updated Flask to version 2.0.0 then you should Degrade Flask to version 1.1.2 and it'll work. And You can simply use the below commands instead of Flask-Script.

Solution 1: Degrade Flask

If you updated Flask to version 2.0.0 then you should Degrade Flask to version 1.1.2 and it’ll work. And You can simply use the below commands instead of Flask-Script.

flask db init # to initialize the database
flask db migrate # to migrate new changes
flask db upgrade # to upgrade and so on.

Solution 2: Use Flask 1.1.4

I installed Flask 1.1.4

pip install "Flask==1.1.4"

And also werkzeug

pip install "werkzeug==1.0.1"

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Please Rate Our Solution to Motivate Us For Give Our Best

Leave a Comment