Python flask-cors ImportError: No module named 'flask-cors' Raspberry pi

I had a similar issue where after installing flask_cors it was still giving me a ModuleNotFoundError. Try this:

sudo pip3 uninstall flask_cors
sudo pip3 install Flask-Cors

It's a subtle difference but it worked for me. Even though flask_cors appears to install a package and it's written that way in python when actually importing it, the actual package name installed with pip is Flask-Cors.


If you import sys and print(sys.path), this will show you where your available packages are installed.

In the event that pip installed flask_cors outside of one of these directories, you should move the file to one of the directories or you can sys.path.append(<your path to flask_cors>).

To prevent pip from installing into a bad directory, I would recommend this answer


It worked for me finally

pip install -U flask-cors