pola-rs/polars · error

activate one of } features

Error message

activate one of {{'dtype-date', 'dtype-datetime', dtype-time'}} features

What it means

This compile-time-feature panic occurs when Polars' CSV schema inference encounters a date/time-typed field (e.g. a parsed temporal column) while none of the features dtype-date, dtype-datetime, or dtype-time were enabled at build time. The inference code panics because it cannot represent the inferred temporal type without those features. It is a build-configuration problem, not a data problem.

Solutions

  1. Re-add the temporal features: use the polars crate with features ["dtype-date", "dtype-datetime", "dtype-time"] (or at minimum the ones you need)
  2. If using polars-labs/polars prebuilt wheels, install the full 'polars' package rather than a slimmed variant
  3. As a workaround, prevent temporal inference (e.g. pass explicit dtypes or set infer_schema_length=0 / try_parse_dates=false) so columns fall back to String

Example fix

// before (Cargo.toml)
polars = { version = "0.46", default-features = false, features = ["csv"] }
// after
polars = { version = "0.46", default-features = false, features = ["csv", "dtype-date", "dtype-datetime", "dtype-time"] }
Defensive patterns

Strategy: fallback

Validate before calling

// Rust build check: verify features before reading temporal CSV columns
#[cfg(not(any(feature = "dtype-date", feature = "dtype-datetime", feature = "dtype-time")))]
compile_error!("CSV temporal inference requires one of dtype-date/dtype-datetime/dtype-time");

Type guard

fn temporal_features_enabled() -> bool {
    cfg!(any(feature = "dtype-date", feature = "dtype-datetime", feature = "dtype-time"))
}

Try / catch

// panic!() is not catchable via Result; guard with catch_unwind only as last resort
let result = std::panic::catch_unwind(|| read_csv(path));
match result { Err(_) => eprintln!("build lacks temporal dtype features; re-add them"), Ok(df) => use(df) }

Prevention

When it happens

Trigger: Calling read_csv / infer schema on CSV data whose columns resolve to a date/datetime/time type (infer_field_schema, reached via infer_types_from_line or hive_partitions_from_paths) with a polars build that has all three of those cargo features disabled.

Common situations: Installing polars with a minimal feature set (e.g. polars-io or polars-lazy with only csv feature) and then reading CSVs containing date-like columns; building from source with `--no-default-features`; trimming dependencies for size and dropping temporal features.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/b02597f7cb284b08. Report an issue: GitHub.

Appendix: source

Thrown at crates/polars-io/src/csv/read/schema_inference.rs:369

                        Pattern::DatetimeYMD | Pattern::DatetimeDMY => {
                            DataType::Datetime(TimeUnit::Microseconds, None)
                        },
                        Pattern::DateYMD | Pattern::DateDMY => DataType::Date,
                        Pattern::DatetimeYMDZ => {
                            DataType::Datetime(TimeUnit::Microseconds, Some(TimeZone::UTC))
                        },
                        Pattern::Time => DataType::Time,
                    },
                    None => DataType::String,
                }
            }
            #[cfg(not(any(
                feature = "dtype-date",
                feature = "dtype-datetime",
                feature = "dtype-time"
            )))]
            {
                panic!("activate one of {{'dtype-date', 'dtype-datetime', dtype-time'}} features")
            }
        } else {
            DataType::String
        }
    }
    // match regex in a particular order
    else if BOOLEAN_RE.is_match(string) {
        DataType::Boolean
    } else if !decimal_comma && FLOAT_RE.is_match(string)
        || decimal_comma && FLOAT_RE_DECIMAL.is_match(string)
    {
        DataType::Float64
    } else if INTEGER_RE.is_match(string) {
        if string.parse::<i64>().is_ok() {
            DataType::Int64
        } else {
            #[cfg(feature = "dtype-i128")]
            {

View on GitHub (pinned to fe841f959e)