email_validator package missing in requirements
You might want to consider adding wtforms[email] as a dependency.
/opt/conda/envs/vds-37/lib/python3.8/site-packages/flask_user/__init__.py:27: in <module>
from .user_manager import UserManager
/opt/conda/envs/vds-37/lib/python3.8/site-packages/flask_user/user_manager.py:14: in <module>
from . import forms
/opt/conda/envs/vds-37/lib/python3.8/site-packages/flask_user/forms.py:54: in <module>
class AddEmailForm(FlaskForm):
/opt/conda/envs/vds-37/lib/python3.8/site-packages/flask_user/forms.py:58: in AddEmailForm
validators.Email(_('Invalid Email')),
/opt/conda/envs/vds-37/lib/python3.8/site-packages/wtforms/validators.py:332: in __init__
raise Exception("Install 'email_validator' for email validation support.")
E Exception: Install 'email_validator' for email validation support.
This is a problem for me too. I solved this temporarily by pinning WTForms to 2.2.1 in my own requirements.txt:
WTForms==2.2.1
flask-wtf does not pin the WTForm version, so this could keep happening if Flask-User does not pin the dependencies of flask-wtf. From https://github.com/lepture/flask-wtf/blob/master/setup.py
install_requires=[
'Flask',
'WTForms',
'itsdangerous',
],
An alternative to pinning in Flask-User might be to advise the user in the docs or during startup to pin the sub-dependencies.
Yep, I encountered this too, and there isn't much I can do about it. Other than installing the email_validator package, which I won't use. The app I am building does not handle emails at all.
This happens because user_manager imports all forms. And the AddEmailForm calls the validator upon setup. In my opinion the cleanest way to fix this is by requiring the wtforms[email] package, which includes the email_validator as a sub-dependency. This was suggested by @cpaulik as well.
There is a duplicate for this at #313.
The issue is that Flask-User uses the WTForms validators.Email validator, and so should either depend on the wtforms[email] extra. Or it should make the dependency optional as well.
For now, you can work around this by directly depending on wtforms[email], no downgrade necessary.