Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install airflow?

I seem to be doing sth. wrong.

https://pythonhosted.org/airflow/start.html

$ export AIRFLOW_HOME=~/airflow
$ pip install apache-airflow
Requirement already satisfied
$ airflow initdb
airflow: Command not found 

python --version
Python 2.7.10

It's weird - the installation seemed to have worked fine (with some warnings - nothing serious) saying: airflow, flask, etc. successfully installed. But even after restarting the PC (Ubuntu 15.10) airflow seems not to be a command.

like image 991
Chris Avatar asked May 05 '16 10:05

Chris


3 Answers

  • You can create a virtual environment for Airflow to keep it as a separate entity: virtualenv airflow_virtualenv
  • Go to the bin folder the virtual env: cd airflow_virtualenv/bin
  • Activate the virtual env: source activate
  • Set the airflow home path: export AIRFLOW_HOME=~/airflow [You can also put this statement in your ~/.profile or ~/.bashrc file so that you don't have to export every time]
  • Install Airflow: pip install apache-airflow [If it throws the "six" error while installing then run: pip install apache-airflow --ignore-installed six]
  • Initialize the database: airflow initdb
  • Start the webserver: airflow webserver -p 8080
  • View the Airflow UI: http://localhost:8080/
like image 99
Neil Avatar answered Nov 09 '22 14:11

Neil


I tried both pip install apache-airflow and pip3 install apache airflow and both had issues because it installed everything in ~/.local/bin/

If you get the error that you cannot run airflow, you will find it in ~/.local/bin/airflow. Then you can add the alias to your .bashrc: alias airflow='~/.local/bin/airflow' then run bash and you will be able to run airflow.

Then when you try to run the webserver with either the python2 or python3 version it will throw an error because it cannot find gunicorn, and you can fix that by adding ~/.local/bin to the PATH:

export PATH=$PATH:~/.local/bin

like image 6
Melanie Day Avatar answered Nov 09 '22 14:11

Melanie Day


Your steps look correct, if you haven't omitted anything else. But you could try Python virtualenv and virtualenvwrapper with following steps to have an isolated airflow environment.

pip install virtualenv
pip install virtualenvwrapper
# update and source your .profile
mkvirtualenv airflow
workon airflow
export AIRFLOW_VERSION=1.7.0
pip install airflow==${AIRFLOW_VERSION}
# optionally other modules
#pip install airflow[celery]==${AIRFLOW_VERSION}
like image 5
Yu You Avatar answered Nov 09 '22 15:11

Yu You