Skip to content

How to install Airflow with pip

Christophe Blefari
Christophe Blefari
1 min read

In order to do a proper local pip Airflow installation there are few tips you need to know. Here is the official Airflow documentation.

Create a virtualenv

First you'll need to create a virtualenv. In order to do this you have many different ways to go. Personally I use virtualfish because I'm on a fish prompt. But I recommend you to start with the easiest version if you're a beginner. Please note that the name you give to the venv command correspond to the folder you will create as a virtualenv.

python3 -m venv airflow-env

Then you need to activate your virtualenv with

source airflow-env/bin/activate

To see if your env is activated you'll have the name within parenthesis at the start of your prompt like (airflow-env).

Then install Airflow

This is probably the easiest part. In order to install Airflow you can use pip while the virtualenv is activated. If you're confortable in Python I eventually recommend you to use Poetry to install Airflow.

pip install apache-airflow

Define AIRFLOW_HOME env variable

This is the most annoying part of installing Airflow locally. In order to make it work properly you'll need to define a AIRFLOW_HOME env variable corresponding to the folder you want to work in.

Run the Airflow init

Now that you have variables defined you can run the init script and create your first user.

airflow db init
airflow users create \
          --username admin \
          --firstname John \
          --lastname Doe \
          --role Admin \
          --email admin@example.org

Launch Airflow

Once everything is done you can run Airflow with the command below and start hacking.

airflow standalone

Data Explorer

The hub to explore Data News links

Search and bookmark more than 1200 links

Explore

Christophe Blefari

Senior Data Engineer. I like 🚲, 🪴 and 🎮. I can do everything with data, just ask.

Comments