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
To see if your env is activated you'll have the name within parenthesis at the start of your prompt like
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 (the working directory).
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 firstname.lastname@example.org
Once everything is done you can run Airflow with the command below and start hacking.
Join the newsletter to receive the latest updates in your inbox.