GitHub user salimuddin07 added a comment to the discussion: "docker compose run 
airflow-cli airflow config list" with Python 3.13 and FAB 5 fails with "cannot 
import name 'SQLA' from 'flask_appbuilder'"

1. Downgrade Flask AppBuilder to a compatible version

The simplest and recommended solution:

Airflow 3.1.x expects FAB 4.x, so in your requirements.txt or Dockerfile:

`RUN pip install "flask-appbuilder<5.0.0"`


Or in requirements.txt:

`flask-appbuilder>=4.3,<5.0`


Then rebuild your image:

```
docker compose build airflow-cli
docker compose run airflow-cli airflow db init
```


This should remove the cannot import SQLA errors and allow the auth manager to 
initialize properly.

2. Consider Python version

Using Python 3.13 is cutting edge; Airflow 3.1.x is mainly tested on Python 
3.10/3.11.

If you run into other dependency issues, consider using Python 3.11 in your 
custom image:

`FROM apache/airflow:3.1.0-python3.11`

3. Verify your auth manager config

After downgrading FAB, ensure your airflow.cfg has a proper auth manager:

```
[core]
auth_backend = airflow.providers.fab.auth_backend.fab_auth_backend
```


This tells Airflow to use FAB for authentication, which should now work 
correctly with FAB 4.x.

Recommended Approach

Pin FAB to 4.x

Stick with Python 3.11 (to match tested Airflow 3.1.x images)

Rebuild the Docker image

Initialize the DB: airflow db init

Start Airflow services: webserver, scheduler, etc.

After this, your Airflow CLI, webserver, and auth manager should work without 
the SQLA import errors.

GitHub link: 
https://github.com/apache/airflow/discussions/56279#discussioncomment-14560225

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to