Expand To Show Full Article
Modulenotfounderror: no module named 'flask_cors' [SOLVED]

Modulenotfounderror: no module named ‘flask_cors’

The modulenotfounderror: no module named ‘flask_cors’ is an error message that users usually encounter, especially while working with Python.

The error message no module named ‘flask_cors’ indicates the module you are trying to import is not installed on your system.

Aside from the solutions that this article can give you.

You’ll also learn why this error message occurs and how to troubleshoot this error.

What is modulenotfounderror: no module named ‘flask_cors’ error?

This error message modulenotfounderror: no module named ‘flask_cors’ usually happens when the module you are importing is missing.

And, if Python interpreter is unable to find the “flask_cors” module that is required to run your program. 

What are the causes of modulenotfounderror: no module named ‘flask_cors’ error?

Here are the common causes of the error no module named flask_cors that you need to fix right away.

1. The module is not installed

If the “flask_cors” module is not installed in the Python environment. Definitely, Python interpreter unable to find the required that results to an error.

2.Incorrect installation:

If the “flask_cors” module is installed, but it is installed incorrectly or it is corrupted, then an error appears.

3.Incompatible version

If you are using a different version of Python also the module you want to import is in different version, an error will arise. The reason that it is not compatible with the version of Flask you are using.

4. Virtual environment issue

When you install the module or the package globally and not in your virtual environment. Certainly, in this error no module named flask_cors occurs.

5. Import incorrectly

If the “flask_cors” module is not imported correctly in the Python environment. It will display an error, you should make sure that you are importing the correct spelling of the module.

How to fix the modulenotfounderror: no module named ‘flask_cors’ error?

Time needed: 2 minutes.

There are several solutions to the modulenotfounderror: no module named ‘flask_cors’ error message.

Here are some of the most common solutions:

  1. Check the module if it is installed

    When the error occurs, the first thing you should do is check if it is installed, using the following commands:

    pip freeze
    pip list

  2. Install the “flask_cors” module

    After you checked and it is not included in the list. Then, you have to install the module this is the first solution to the error message and it should be installed in the Python environment.

    Open the terminal or command prompt and execute the following command:

    pip install flask_cors

    You can simply check if it is successfully installed:
    pip3 show flask_Cors

  3. Check the version compatibility

    Check the version of “flask_cors” you installed on your system if it is compatible with the version of Python being used.

    If not, you need to update the version of the module or install a compatible version of “flask_cors”.

    To check Python version
    python –version

    If you are using Python version 3.11.2, you should install the flask_cors package or module using the following command:

    pip3.11 install flask_cors

    Alternatively, you can upgrade the module: 

    pip3 install flask_cors –upgrade

  4. Check the correct the import statement

    You have to double-check if the import statement for the “flask_cors” module is correct. The import statement should be like this:

    from flask_cors import CORS
    from flask import Flask

  5. Reinstalling the module

    If you tried all the solutions and the error still exists, you can try to reinstall the module.

    To uninstall:
    pip3 uninstall flask-cors

    To reinstall:
    pip3 install Flask-Cors

Additional solutions for modulenotfounderror: no module named ‘flask_cors’ error

If you are using a different platform and you get this error, you can install the module using these commands:

conda install -c anaconda flask-cors

Jupyter Notebook:
!pip install Flask-Cors

Py alias (Windows):
py -m pip install Flask-Cors

When you get permissions error:
sudo pip3 install Flask-Cors
pip install Flask-Cors –user

When you don’t have pip in your PATH environment variable:
python -m pip install Flask-Cors

Python 3:
pip3 install Flask-Cors
python3 -m pip install Flask-Cors

Virtual environment or using Python 2:
pip install Flask-Cors


This article already provided the solution to modulenotfounderror: no module named ‘flask_cors’ , an error message while working in flask in Python.

By following the solutions provided above you’ll fix the no module named ‘flask_cors’ in no time.

We also have solutions if you encounter an error like modulenotfounderror: no module named ‘bio’. 

Thank you very much for reading until the end of this article.

Leave a Comment