Posted at

airflow initdb実行時にImportError(CSRFProtect)が出たときの解決方法

More than 1 year has passed since last update.


事象

airflow initdb実行時にこんな感じのエラーが出た


log

Traceback (most recent call last):

File "/usr/bin/airflow", line 18, in <module>
from airflow.bin.cli import CLIFactory
File "/usr/lib/python2.7/site-packages/airflow/bin/cli.py", line 59, in <module>
from airflow.www.app import cached_app
File "/usr/lib/python2.7/site-packages/airflow/www/app.py", line 21, in <module>
from flask_wtf.csrf import CSRFProtect
ImportError: cannot import name CSRFProtect


解決方法

以下のコマンドを実行してflask-wtfをアップデートする

pip install --user --upgrade flask-wtf


参考

Can't import csrf module from within flask_wtf