Skip to content

[BUG] MLflow tracking crashes with SQLAlchemy 2.1 when mlflow is older than 3.9 #624

Closed

Description

@jorisstrakeljahn

Describe the bug

I ran into this while setting up DeepTab in a fresh environment with an older mlflow. When I turned on MLflow tracking, fit() crashed before training started. It happens when mlflow is older than 3.9 and SQLAlchemy 2.1 is installed. The error is an ImportError that comes from inside mlflow.

Older mlflow versions import a class from SQLAlchemy that SQLAlchemy 2.1 removed. mlflow fixed this in 3.9.0 (mlflow/mlflow#20203). DeepTab still allows mlflow from 2.10, and mlflow 2.22.0 does not block SQLAlchemy 2.1, so pip accepts this combination.

I think CI did not catch it because no test built a real MLflow logger. The minimum-dependency CI jobs that install mlflow (extras and tabr) get mlflow 2.22.0 with SQLAlchemy 2.1, and the new test in #544 fails there with the same ImportError.

To Reproduce

  1. Create a fresh environment and install DeepTab together with an older mlflow:
pip install "deeptab[mlflow]==2.1.0" "mlflow==2.22.0" "sqlalchemy==2.1.8"
  1. Run this script. It fits a small classifier on random data with MLflow tracking turned on:
import tempfile

import numpy as np

from deeptab.core.observability import ObservabilityConfig
from deeptab.models import MLPClassifier

rng = np.random.default_rng(0)
X = rng.normal(size=(80, 4))
y = (X[:, 0] > 0).astype(int)
with tempfile.TemporaryDirectory() as root:
    obs = ObservabilityConfig(root_dir=root, experiment_trackers=["mlflow"])
    MLPClassifier(observability_config=obs).fit(X, y, max_epochs=1)
  1. It stops with this error:
ImportError: cannot import name 'FallbackAsyncAdaptedQueuePool' from 'sqlalchemy.pool'

With mlflow 3.9.0 and the same SQLAlchemy version the same script finishes without an error.

Expected behavior

fit() should work with every mlflow version that DeepTab allows.

Screenshots

Desktop (please complete the following information):

  • OS: macOS
  • Python version: 3.12
  • deeptab Version: 2.1.0 from PyPI

Additional context

I think the simplest fix is to require mlflow>=3.9 in the extras. I will open a PR for that

Activity

  1. added
    bug
    on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions