Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to import authentication backend after changing the airflow.cfg

Tags:

flask

airflow

After changing the airflow.cfg, I simply changed the authenticate to True like this:

[webserver]
authenticate = True
auth_backend = airflow.contrib.auth.backends.password_auth

when I run command airflow webserver, there was an Error as below:

  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

Just added the content in airflow.cfg file.

[webserver]
authenticate = True
auth_backend = airflow.contrib.auth.backends.password_auth
like image 773
DennisLi Avatar asked Jul 10 '19 08:07

DennisLi


3 Answers

Solved it .

pip install flask-bcrypt
like image 187
DennisLi Avatar answered Oct 29 '22 04:10

DennisLi


pip3 install flask-bcrypt --user

did the trick for me.

like image 22
Shiva S Avatar answered Oct 29 '22 05:10

Shiva S


The official way to fix this error is by installing the password subpackage, which will pull in the needed dependencies for password authentication.

pip install 'apache-airflow[password]'

A list of available subpackages is available in the airflow docs.

like image 41
wf. Avatar answered Oct 29 '22 05:10

wf.