mlflow/mlflow · error · ImportError
mlflow.data.polars_dataset requires polars>=1.0.0, found {pl
Error message
mlflow.data.polars_dataset requires polars>=1.0.0, found {pl.__version__} What it means
mlflow/data/polars_dataset.py requires polars 1.0.0 or newer. At import time it compares the installed polars major version and raises ImportError if the major version is below 1. This guards use of polars 1.x-only APIs such as polars.datatypes.classes imports used later in the module.
Source
Thrown at mlflow/data/polars_dataset.py:11
import json
import logging
from functools import cached_property
from inspect import isclass
from typing import Any, Final, TypedDict
import polars as pl
from packaging.version import Version
if Version(pl.__version__).major < 1:
raise ImportError(f"mlflow.data.polars_dataset requires polars>=1.0.0, found {pl.__version__}")
from polars.datatypes.classes import DataType as PolarsDataType
from polars.datatypes.classes import DataTypeClass as PolarsDataTypeClass
from mlflow.data.dataset import Dataset
from mlflow.data.dataset_source import DatasetSource
from mlflow.data.evaluation_dataset import EvaluationDataset
from mlflow.data.pyfunc_dataset_mixin import PyFuncConvertibleDatasetMixin, PyFuncInputsOutputs
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
from mlflow.types.schema import Array, ColSpec, DataType, Object, Property, Schema
_logger = logging.getLogger(__name__)
def hash_polars_df(df: pl.DataFrame) -> str:
# probably not the best way to hash, also see:
# https://github.com/pola-rs/polars/issues/9743View on GitHub (pinned to 6a27f2decc)
Solutions
- Upgrade polars: uv pip install -U 'polars>=1.0.0' (or pip install -U polars).
- Pin polars>=1.0.0 in your requirements to prevent dependency resolvers from downgrading it.
- If you cannot upgrade polars, avoid mlflow.data.polars_dataset and use from_pandas instead.
- Recreate the environment after the upgrade to clear cached 0.x installs.
Example fix
// before (requirements.txt) polars==0.20.31 // after (requirements.txt) polars>=1.0.0
Defensive patterns
Strategy: validation
Validate before calling
import polars as pl
from packaging.version import Version
if Version(pl.__version__).major < 1:
raise EnvironmentError(f"polars>=1.0.0 required, found {pl.__version__}") Type guard
def polars_supported() -> bool:
import polars as pl
from packaging.version import Version
return Version(pl.__version__).major >= 1 Try / catch
try:
from mlflow.data import polars_dataset
except ImportError as e:
if "requires polars" in str(e):
raise SystemExit("Upgrade polars: pip install 'polars>=1.0.0'") from e
raise Prevention
- Pin polars>=1.0.0 in requirements and lockfiles
- Run a version check early at app startup, not deep in MLflow imports
- Watch transitive dependencies that might downgrade polars (pip check / uv lock)
- Test in CI with the same dependency resolution as production
When it happens
Trigger: Importing mlflow.data.polars_dataset (directly or via mlflow.data.from_polars / mlflow.data module loading) while a polars version <1.0.0 (e.g. 0.20.x) is installed.
Common situations: Old polars pinned in requirements.txt; an environment where another package constrained polars to a 0.x release; upgrading mlflow without upgrading polars; stale virtualenv from before polars 1.0 existed.
Related errors
- The `databricks-agents` package is required to use labeling
- GEPA >= 0.0.26 is required. Please install it with: `pip ins
- INVALID_PARAMETER_VALUE
- `load_image` requires Pillow. Please install it via: pip ins
- Unknown type: {dtype!r}
AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29).
Data as JSON: /api/errors/b2bc32c5fce90fa2.
Report an issue: GitHub.