Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named flask_wtf

I am getting the error, ImportError: No module named flask_wtf. I tried every possible solution. I installed flask-wrf using -

$ flask/bin/pip install flask-wtf

Requirement already satisfied: flask-wtf in ./flask/lib/python2.7/site-packages
Requirement already satisfied: WTForms in ./flask/lib/python2.7/site-packages.

Please help me out with this issue.

I am sharing my code which shows error:

from flask_wtf import Form 
from wtforms import StringField, BooleanField
from wtforms.validators import DataRequired
    
class LoginForm(Form):
    openid = StringField('openid', validators=[DataRequired()])
    remember_me = BooleanField('remember_me', default=False)
like image 380
kanishka makhija Avatar asked May 23 '17 00:05

kanishka makhija


2 Answers

I also have same issue. But installing Flask-WTF

pip install flask-wtf

I was able to resolve this issue.

like image 127
GPrathap Avatar answered Sep 17 '22 01:09

GPrathap


Ensure you run the virtual environment's python rather than global python. I resolved this in my windows env through executing:

\inetpub\projectFolder\scripts\python.exe run.py

rather than just

python run.py

Also, make sure that you have installed the modules to the virtual environment rather than globally. Check that the modules exist appropriately - again under windows I checked for the file:

\inetpub\projectFolder\lib\site-packages\wtforms 
like image 43
Piquet Avatar answered Sep 18 '22 01:09

Piquet