Modulenotfounderror: no module named ‘flask.ext’

Encountering errors like modulenotfounderror: no module named ‘flask.ext’ in Python is common.

This error occurs when you import a Flask extension that’s been deleted from the most recent Flask release.

In this article, we will show you how to solve this error.

But before that, let’s first have a brief understanding of Python.

What is Python?

Python is one of the most popular programming languages.

It is used for developing a wide range of applications.

In addition, Python is a high-level programming language that is used by most developers due to its flexibility.

Returning to our issue, we must take a few actions to fix this error.

So, without further ado, let’s move on to our “how to fix this error” tutorial.

How to solve “no module named ‘flask.ext’” in Python

Time needed: 2 minutes

Here’s how to resolve the modulenotfounderror: no module named ‘flask.ext’ in Python.

  1. Update the Flask installation.


    Resolving the error modulenotfounderror: no module named ‘flask.ext’ is an easy task.

    All you have to do is update your Flask installation and revise your code when importing extensions from their packages.

    To update your Flask installation, input the command pip install –upgrade Flask.

    pip install --upgrade Flask - Modulenotfounderror: no module named 'flask.ext' [SOLVED]

    The command pip install –upgrade Flask will update your Flask installation to its latest version.

  2. Revise your code.


    After updating your Flask installation, revise or change your code when importing extensions right from their own packages.

    For example:

    Instead of using the code from flask.ext.bootstrap import Bootstrap to import, revise your code to from flask_bootstrap import Bootstrap.

    Another example:

    Instead of using the flask.ext.sqlalchemy extension, revise your code to from flask_sqlalchemy import SQLAlchemy.

See also: Modulenotfounderror: no module named ‘pyautogui’

Tip: After updating your Flask installation and revising your code, test your code by running your Flask application to check if there are any errors.

Commands you might need

  • pip list

    This command will display all the packages installed on your system, including their versions.

    If you’re using Jupyter Notebook, use the !pip list command.

    However, if you’re using Anaconda, use the command conda list.
  • python –version

    Use this command if you want to check what version of Python you have.

Conclusion

In conclusion, the error modulenotfounderror: no module named ‘flask.ext’ can be easily solved by updating your Flask installation and revising your code when importing extensions from their packages.

By following the guide above, there’s no doubt that you’ll be able to resolve this error quickly.

We hope you’ve learned a lot from this.

Thank you for reading!

1 thought on “Modulenotfounderror: no module named ‘flask.ext’”

Leave a Comment