Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.4K
Vistas
WTForms: Install 'email_validator' for email validation support

Getting exception when running the following code for form validation.

File "/Users/homeduvvuri/Documents/Learning/PartyGoUdemy/PartGo/user/forms.py", line 11, in BaseUserForm
    email = EmailField('Email', [validators.DataRequired(), validators.Email()])
File "/Users/homeduvvuri/Documents/Learning/PartyGoUdemy/PartGo/partgo-env/lib/python3.7/site-packages/wtforms/validators.py", line 332, in __init__
    raise Exception("Install 'email_validator' for email validation support.")
Exception: Install 'email_validator' for email validation support.

Runs perfectly on codeanywhere VM. Does not on local machine.

from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from wtforms import Form, StringField, PasswordField, validators, ValidationError
from wtforms.validators import InputRequired, Email
from wtforms.fields.html5 import EmailField
from wtforms.widgets import TextArea
from user.models import User

class BaseUserForm(FlaskForm):
    name = StringField('Name', [validators.DataRequired(), validators.Length(min=2, max=30)])
    email = EmailField('Email', [validators.DataRequired(), validators.Email()])
over 4 years ago · Santiago Trujillo
16 Respuestas
Responde la pregunta

0

If you take a look at wtforms/validators.py file in line 9:

import email_validator

Just install the package:

pip install email_validator
over 4 years ago · Santiago Trujillo Denunciar

0

I had the same problem with the latest updates, tried to install email_validator and flask-validator and continued with this exception. Solved by adding in requirements.txt the following line: email-validator == 1.0.5 as suggested [here].(https://github.com/alphagov/notifications-admin/commit/5ce2906c5aa6d16)

Actually wtforms[email]==2.3.1 is what I need.

over 4 years ago · Santiago Trujillo Denunciar

0

If you want it installed with wtforms:

pip install wtforms[email]
over 4 years ago · Santiago Trujillo Denunciar

0

Try install

pip install email-validator
over 4 years ago · Santiago Trujillo Denunciar

0

This happened to me as well when i run it using virtual env. anaconda 3.7 However when i switched my project interpreter back to my local machine Python 3.7, then i run:

pip install email_validator

it worked fine.

I just found it strange that I couldn't install the module "email_validator" in my anaconda Project Interpreter. So i suggest that you try with local machine first.

over 4 years ago · Santiago Trujillo Denunciar

0

Try install

pip install WTForms==2.1 
over 4 years ago · Santiago Trujillo Denunciar

0

you need pip install email-validator, wtforms depend on email-validator.

you can see email-validator module on Github https://github.com/JoshData/python-email-validator

over 4 years ago · Santiago Trujillo Denunciar

0

I don't know if the root cause was that I used zsh in Terminal but I also get the error "zsh: no matches found: wtforms[email]" when I tried the command below.

pip install wtforms[email]

However, I tried to do the following command, it worked for me.

pip install -U "wtforms[email]"
over 4 years ago · Santiago Trujillo Denunciar

0

Adding to what is already said for future referance,

pip install email_validator

P.S You dont need to import email_validator after installing.

over 4 years ago · Santiago Trujillo Denunciar

0

from wtf forms

Validates an email address. Requires email_validator package to be installed. For ex: pip install wtforms[email].

pip install wtforms[email]

pip install email_validator
over 4 years ago · Santiago Trujillo Denunciar

0

If we use wtforms.validators.Email in our python program, then it raise an exception that asks us to install the email_validator for email validation support. The solution for that problem is to type the following command in terminal pip install email_validator

over 4 years ago · Santiago Trujillo Denunciar

0

From WTForms 2.3.0 version, the email validation is handled by an external library called email-validator (PR #429). If you want to enable email validation support, you either need to install WTForms with extra requires email:

$ pip install wtforms[email]

Or you can install email-validator directly:

$ pip install email-validator

Or you can back to the old version of WTForms:

$ pip install wtforms==2.2.1

P.S. If you are using Flask-WTF, except for install email-validator directly, you can also use email extra (if PR #423 got merged) in the next release (> 0.14.3).

over 4 years ago · Santiago Trujillo Denunciar

0

In your project directory run:

pip install email_validator

This worked for me!

over 4 years ago · Santiago Trujillo Denunciar

0

This should work as it worked for me. Just install this in project terminal:

pip install email-validator

over 4 years ago · Santiago Trujillo Denunciar

0

If you have removed build dependencies before running your app, please check whether idna exists.

For Alpine Linux, use apk add py3-idna before installing build dependencies. Then this package will not be in the build dependency virtual package so will not be removed automatically.

over 4 years ago · Santiago Trujillo Denunciar

0

Inside wtforms/validators.py file, line 392, you can see that there is exception handling for this occurrence in particular, which is why the following lines are executed to throw the alert

if email_validator is None:  # pragma: no cover
            raise Exception("Install 'email_validator' for email validation 
 support.")

Solution is to pip install email-validator in the same location/directory for wtforms/validators.py sake.

I had the same error before:(

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda