This week I ran into a challenge with the versions of Python and Ubuntu conflicting. A point to note is that the most recent versions are not always the best. This article explores the use of Mise as a development environment manager, particularly for Python development and the installation of Apache Airflow on a local machine.
Understanding Mise.
Mise (formerly known as rtx) is a fast and modern development tool manager that allows developers to install and manage multiple versions of programming languages and development tools.
Installing Mise
Linux and macOS
curl https://mise.run | sh
Managing Python with Mise
Mise is majorly used for Python Version Management.
Installing Python 3.12
mise install python@3.12
mise use --global python@3.12
*Verify:
*
python --version
Expected output:
*Python 3.12.x
*
Using Apache Airflow.
Apache Airflow has strict compatibility requirements regarding Python versions and package dependencies.
Using Mise allows developers to isolate Airflow within a dedicated project environment while ensuring the correct Python version is used.
Installing Apache Airflow Using Mise
Step 1: Create a Project Directory
mkdir airflow-local
cd airflow-local
Step 2: Configure Python
mise use python@3.12
Verify:
python --version
Step 3: Create a Virtual Environment
Although Mise manages Python versions, it is still recommended to use a virtual environment for package isolation.
python -m venv .venv
Activate it:
Linux/macOS:
source .venv/bin/activate
Windows:
.venv\Scripts\activate
Step 4: Upgrade Pip
pip install --upgrade pip
Step 5: Install Apache Airflow
Airflow recommends using official constraints files.
For Airflow 3.x:
AIRFLOW_VERSION=3.0.2
PYTHON_VERSION=3.12
pip install "apache-airflow==${AIRFLOW_VERSION}" \
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt"
Step 6: Initialize Airflow
airflow db migrate
Create an administrative user:
airflow users create \
--username admin \
--firstname Admin \
--lastname User \
--role Admin \
--email admin@example.com
Step 7: Start Airflow
Start the scheduler:
airflow scheduler
In a separate terminal:
airflow webserver
The Airflow interface becomes available at:
http://localhost:8080
Top comments (0)