Last active
February 5, 2025 07:06
-
-
Save Kilo59/f63bb36af6c4399057e17fb0410cac21 to your computer and use it in GitHub Desktop.
Install Apache Airflow into a pipx venv with the correct requirements.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assuming pipx is already installed | |
# https://pipxproject.github.io/pipx/installation/ | |
# airflow needs a home, ~/airflow is the default, | |
# but you can lay foundation somewhere else if you prefer | |
# (optional) | |
export AIRFLOW_HOME=~/airflow | |
AIRFLOW_VERSION=2.0.1 | |
PYTHON_VERSION="$(python3 --version | cut -d " " -f 2 | cut -d "." -f 1-2)" | |
# For example: 3.6 | |
CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt" | |
# For example: https://raw.githubusercontent.com/apache/airflow/constraints-2.0.1/constraints-3.9.txt | |
pipx install "apache-airflow==${AIRFLOW_VERSION}" --pip-args="--constraint '${CONSTRAINT_URL}'" | |
# initialize the database | |
airflow db init | |
airflow users create \ | |
--username admin \ | |
--firstname Peter \ | |
--lastname Parker \ | |
--role Admin \ | |
--email [email protected] | |
# start the web server, default port is 8080 | |
airflow webserver --port 8080 -D | |
# start the scheduler | |
# open a new terminal or else run webserver with ``-D`` option to run it as a daemon | |
airflow scheduler | |
# visit localhost:8080 in the browser and use the admin account you just | |
# created to login. Enable the example_bash_operator dag in the home page |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment