更改airflow.cfg后,运行命令“ airflow webserver” 出现以下错误:
File "/home/airflow/.pyenv/versions/3.7.3/lib/python3.7/site-packages/airflow/contrib/auth/backends/password_auth.py", line 33, in <module>
from flask_bcrypt import generate_password_hash, check_password_hash
ModuleNotFoundError: No module named 'flask_bcrypt'
...
File "/home/airflow/.pyenv/versions/3.7.3/lib/python3.7/site-packages/airflow/__init__.py", line 73, in load_login
raise AirflowException("Failed to import authentication backend")
airflow.exceptions.AirflowException: Failed to import authentication backend
只需将内容添加到airflow.cfg文件中即可。
[webserver]
authenticate = True
auth_backend = airflow.contrib.auth.backends.password_auth
答案 0 :(得分:1)
解决了。
pip install flask-bcrypt
答案 1 :(得分:1)
pip3 install flask-bcrypt --user
是我的把戏。
答案 2 :(得分:1)
解决此错误的官方方法是安装password
子软件包,该子软件包将引入密码验证所需的依赖项。
pip install 'apache-airflow[password]'
in the airflow docs中提供了可用子软件包的列表。