Skip to content Skip to sidebar Skip to footer

Modulenotfounderror: No Module Named 'flask_wtforms'

Am new in flask , but am getting this error , i tired searching on different questions on stackoverflow but i have found none which work, below is the error am getting: Traceback (

Solution 1:

Change your imports on line 6 to:

from wtforms import Form, BooleanField, StringField, PasswordField, validators

Solution 2:

I have same problem when I installed a new server with virtualenv.

This is the output when I installed Flask:

$ pip install flask
Collecting flask
  Downloading 
....
Building wheels forcollected packages: itsdangerous, MarkupSafe
  Running setup.py bdist_wheel foritsdangerous ... done

....
Successfully built itsdangerous MarkupSafe
Installing collected packages: click, Werkzeug, itsdangerous, MarkupSafe, Jinja2, flask
Successfully installed Jinja2-2.10 MarkupSafe-1.0 Werkzeug-0.14.1 click-6.7 flask-1.0.2 itsdangerous-0.24

I tried to run minimal script:

$ python app.py 
Traceback (most recent calllast):
  File "app.py", line 2, in<module>from wtforms import Form, BooleanField, StringField, PasswordField, validators
ImportError: Nomodule named wtforms

What I understand is WTFORMS is not installed. I've search in another post and this works for me (How can I import Flask-WTF?):

$ pip install flask-wtf
Collecting flask-wtf
  Downloading 
....
Collecting WTForms (from flask-wtf)
  Downloading 
....
100% |████████████████████████████████| 174kB 345kB/s 
Requirement already satisfied: Flask in ./lib/python2.7/site-packages (from flask-wtf) (1.0.2)
Requirement already satisfied: click>=5.1 in ./lib/python2.7/site-packages (from Flask->flask-wtf) (6.7)
Requirement already satisfied: Werkzeug>=0.14 in ./lib/python2.7/site-packages (from Flask->flask-wtf) (0.14.1)
Requirement already satisfied: itsdangerous>=0.24 in ./lib/python2.7/site-packages (from Flask->flask-wtf) (0.24)
Requirement already satisfied: Jinja2>=2.10 in ./lib/python2.7/site-packages (from Flask->flask-wtf) (2.10)
Requirement already satisfied: MarkupSafe>=0.23 in ./lib/python2.7/site-packages (from Jinja2>=2.10->Flask->flask-wtf) (1.0)
Installing collected packages: WTForms, flask-wtf
Successfully installed WTForms-2.2.1 flask-wtf-0.14.2

Post a Comment for "Modulenotfounderror: No Module Named 'flask_wtforms'"