ModuleNotFoundError: No module named 'flask_wtf'

Hello. As you can see below, I can't import flask_wtf and it isn't in my site-packages folder. I have tried installing and upgrading it, with no success, despite of the fact I always get the return stating "Requirement already up-to-date" or "Requirement already satisfied".


Error running WSGI application
2019-01-11 00:31:52,426: ModuleNotFoundError: No module named 'flask_wtf'
2019-01-11 00:31:52,426:   File "/var/www/", line 16, in <module>
2019-01-11 00:31:52,426:     from flask_app import app as application  # noqa
2019-01-11 00:31:52,426: 
2019-01-11 00:31:52,427:   File "/home/juliosouto/mysite/", line 9, in <module>
2019-01-11 00:31:52,427:     from flask_wtf import Form #FlaskForm, TextField, TextAreaField, SubmitField, validators, ValidationError


I have tried these 2 different ways:

from import Form, TextField, TextAreaField, SubmitField, validators, ValidationError

from flask_wtf import Form, FlaskForm, TextField, TextAreaField, SubmitField, validators, ValidationError

What can I do to make it work?

[edit by admin: formatting]

How are you installing it? It looks like your website is configured to use a virtualenv, so you need to start a bash console inside that virtualenv (there's a shortcut link to do that on the "Web" page) and then pip install from there.

I installed using a bash console. command "pip3 install --user flask_wtf". Also using "Flask_WTF". But in both cases the console said it was already satisfied. Also, I installed marshmallow using the same command. It was installed in the site-packages folder, but I cannot import it either.

Just as complementary: flask_wtf seemed it was installed already (before I try to install it), but it is not in the site-packages folder. On the other hand, marshmallow wasn't previously installed. It was installed by me and it is in the site-packages folder. But none of them can be imported on Flask.

Yes, if you try to install using the "--user" flag in a normal Bash console then it will say that flask_wtf is already installed because we have a site-wide installation of that package. And if you try to install something that is not already installed, it will put it in the appropriate place under .local.

But your website is using a virtualenv. A virtualenv is a completely different set of installed packages. Packages that you install using "--user" will not go into the virtualenv. In order to install into it, you need to activate the virtualenv and then use pip install without the "--user" flag. The easiest way to do this is:

  • Go to the "Web" page -- not the "Consoles" page
  • Click on the "Start a bash console in this virtualenv" link, which you will see in the "Virtualenv:" section.
  • In the bash console that appears after that, use pip install without the "--user" flag to install the packages you need.

Perfect! It worked now! Thanks, Giles.