Reputation: 71
Getting below error while starting Airflow webserver
[email protected]:~$ airflow webserver -p 8080 [2018-12-03 00:29:37,066] {init.py:51} INFO - Using executor SequentialExecutor
[2018-12-03 00:29:38,776] {models.py:271} INFO - Filling up the DagBag from /Users/balajee/airflow/dags Running the Gunicorn Server with: Workers: 4 sync Host: 0.0.0.0:8080 Timeout: 120
Error: No module named 'airflow.www'
Upvotes: 7
Views: 11376
Reputation: 1433
I got the same issue using latest airflow version 2.5.0
Make sure env variable AIRFLOW_HOME is pointing to right location
Thanks all for sharing
Upvotes: 0
Reputation: 335
I solved this by starting the webserver from the airflow folder itself.
I was previously trying to open the server from the home directory but the required modules could not be found which may be the case here.
Late to the party but could help others who get here.
Upvotes: 0
Reputation: 438
I did this steps for the problem happens:
conda activate
pip install apache-airflow
No module named 'airflow.www'
was showed for meTo fix follow this steps:
whereis gunicorn
/home/yourname/anaconda3/envs/airflow_env/bin/gunicorn
Another way to verify if gunicorn is in another directories is printing your PATH variable: echo $PATH
. Look for gunicorn in /home/yourname/.local/bin
and another anaconda directories from PATH. Remove all references. Remove gunicorn from conda base env as well: pip uninstall gunicorn
.
With this steps, I think your problem will be solved.
I used anaconda distribution, but I think the same process can be done without it. I used airflow 1.10.0 and python 3.6.
Upvotes: 1
Reputation: 1
please check if gunicorn is installed already in server. for me it was installed in /usr/local/bin and it was taking precedence over gunicorn version installed with airflow. uninstall earlier one or fix $PATH variable
Upvotes: 0
Reputation: 430
Fixed for me
pip3 uninstall -y gunicorn
pip3 install gunicorn==19.4.0
Upvotes: 10
Reputation: 483
If you have defined a custom home directory for airflow other than default one (~/airflow
) during the installation:
export AIRFLOW_HOME=/your/custom/path/airflow
airflow webserver -p 8080
airflow scheduler
Upvotes: 0
Reputation: 352
I got this problem this morning, and I found a strange solution, may it helps you. I think maybe you just need to change the command running directory.
I install airflow
basic dependence in my virtualenv
directory venv
with PyCharm help, and I use PyCharm build-in Terminal
tab to directly access my venv
, and I use airflow initdb
to init sqlite database to store all my logs and ops, then according to the official tutorial I use airflow webserver
to start the webserver. But somehow today I use my Mac terminal, and start virtulenv, and start airflow webserver, and I encounter this problem with:
Running the Gunicorn Server with:
Workers: 4 sync
Host: 0.0.0.0:8080
Timeout: 120
Logfiles: - -
=================================================================
Error: No module named 'airflow.www'
[2019-05-26 07:45:27,130] {cli.py:833} ERROR - No response from gunicorn master within 120 seconds
[2019-05-26 07:45:27,130] {cli.py:834} ERROR - Shutting down webserver
And I tried @Evgeniy Sobolev's solution by reinstall gunicorn
and nothing changed, but when I still using my PyCharm Terminal, it can still running successfully. I guess maybe it is because the first directory
you init your db and running webserver is critical. By default when I use PyCharm Terminal to init db and start webserver is the Project root directory
, like:
(venv) root@root:~/GitHub/FakeProject$ airflow webserver
But today I check into venv
to start virtualenv, and the root directory changed!
root@root:~/GitHub/FakeProject/SubDir$ source venv/bin/activate
(venv) root@root:~/GitHub/FakeProject/SubDir$ airflow webserver
** Error **
So in this way it encounters Error: No module named 'airflow.www'
, so I check out the directory, and the webserver running successfully just like PyCharm Terminal:
(venv) root@root:~/GitHub/FakeProject/SubDir$ cd ..
(venv) root@root:~/GitHub/FakeProject$ airflow webserver
** It works **
I thought maybe airflow store some metadata (like setup a PATH, maybe) in the first time init your airflow db, so you can not change your command running directory.
I hope it may help somebody in the future. Just check your directory!
Upvotes: 3
Reputation: 93
Looks like you have a problem with gunicorn. Try to execute this two commands:
sudo -H pip3 uninstall -y gunicorn
sudo -H pip3 install gunicorn
It should resolve your problem, cause airflow show you not clear error message related to gunicorn problems
Upvotes: 1