Skip to content

unsupported narwhals import #3688

@mattijn

Description

@mattijn

What happened?

I currently get this error when trying to import altair:

ImportError: cannot import name 'is_into_dataframe' from 'narwhals.dependencies' 

This part is not safe at the moment:

from narwhals.dependencies import is_into_dataframe

The function is_into_dataframe is introduced in narwhals v1.13.1, but our demand is:

"narwhals>=1.5.2"

Btw, should this not be referenced by making use of the stable v1 of narwhals?

import narwhals.stable.v1 as nw
...
return isinstance(data, DataFrameLike) or nw.dependencies.is_into_dataframe(data)

I notice elsewhere we mixed the stable.v1 with just-import-direct approach:

import narwhals.stable.v1 as nw
from narwhals.dependencies import get_polars, is_pandas_dataframe
from narwhals.typing import IntoDataFrame

What would you like to happen instead?

Probably best is to update the pyproject.toml file.

Which version of Altair are you using?

main

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions