pola-rs/polars · error · AttributeError

module has no attribute

Error message

module {__name__!r} has no attribute {name!r}

What it means

Module-level __getattr__ fallback in polars.type_aliases: an attribute was looked up that is neither a real member of the module nor a known alias in polars._typing. The deprecated forwarding shim only re-exports names that exist in polars._typing; anything else is genuinely missing. Import from polars._typing or define your own alias.

Solutions

  1. Import the attribute from its actual module instead; `polars.type_aliases` only re-exports a fixed set of names and was removed in newer versions.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at py-polars/src/polars/type_aliases.py:24 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19). Data as JSON: /api/errors/c89bd7dc78d033da. Report an issue: GitHub.

Appendix: source

Thrown at py-polars/src/polars/type_aliases.py:24

from typing import Any

import polars._typing as plt
from polars._utils.deprecation import issue_deprecation_warning


def __getattr__(name: str) -> Any:
    if name in dir(plt):
        issue_deprecation_warning(
            "the `polars.type_aliases` module was deprecated in version 1.0.0."
            " The type aliases have moved to the `polars._typing` module to explicitly mark them as private."
            " Please define your own type aliases, or temporarily import from the `polars._typing` module."
            " A public `polars.typing` module will be added in the future.",
        )
        return getattr(plt, name)

    msg = f"module {__name__!r} has no attribute {name!r}"
    raise AttributeError(msg)

View on GitHub (pinned to 9b5d73fd00)