Environment:Pola rs Polars Rust Build Environment
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Build_System |
| Last Updated | 2026-02-09 10:00 GMT |
Overview
Rust 2024 edition build environment with workspace-managed dependencies for building the Polars multi-crate project (v0.53.0) from source.
Description
This environment defines the toolchain and dependency requirements for building Polars from Rust source code. The project uses a Cargo workspace with 20+ crates, the Rust 2024 edition, and extensive feature flags to control optional functionality. It requires both stable and nightly Rust toolchains (nightly for development tools like Miri). The build system uses jemalloc (custom fork) and supports multiple compilation profiles (dev, release, dist-release with fat LTO).
Usage
Use this environment when contributing to the Polars Rust codebase, building custom Polars binaries, or compiling the Python extension from source. This is not required for end users installing pre-built wheels from PyPI.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, Windows (WSL recommended) | Native Windows may have symlink issues |
| Rust | Edition 2024 (stable + nightly) | Nightly needed for Miri and SIMD features |
| Python | >= 3.10 | For building Python bindings |
| Disk | >= 10GB | Cargo target directory can be large |
| RAM | >= 8GB | Heavy compilation with many crates |
Dependencies
System Packages
- Rust stable toolchain (via rustup)
- Rust nightly toolchain with `miri` component
- `dprint` (code formatter)
- `cmake` (for some native dependencies)
Key Rust Dependencies (Workspace)
- `pyo3` = 0.27 (Python bindings)
- `tokio` = 1.44 (async runtime)
- `rayon` = 1.9 (parallelism)
- `chrono` <= 0.4.41 (datetime, pinned maximum)
- `serde` = 1.0.188 (serialization)
- `object_store` = 0.13 (cloud storage)
- `sqlparser` = 0.60 (SQL support)
- `simd-json` = 0.17 (SIMD JSON parsing)
- `ndarray` = 0.17 (N-dimensional arrays)
- `tikv-jemallocator` (custom fork for memory allocation)
Feature Flags (Selected)
Performance:
- `simd` - SIMD optimizations
- `avx512` - AVX-512 support
- `nightly` - Requires Rust nightly
- `performant` - More fast paths, slower compile
Data Formats:
- `csv`, `parquet`, `json`, `ipc`, `avro`
Cloud Storage:
- `aws`, `azure`, `gcp`, `http`
Execution:
- `lazy` - Lazy evaluation engine
- `streaming` - Streaming/out-of-core processing
- `sql` - SQL query interface
- `async` - Async I/O operations
Credentials
No credentials required for building.
Quick Install
# Install Rust toolchains
rustup toolchain install stable
rustup toolchain install nightly --component miri
# Install dprint formatter
cargo install dprint
# Build Polars with default features
cargo build -p polars
# Build with specific features
cargo build -p polars -F lazy,parquet,csv,json
# Build Python extension (development)
cd py-polars
pip install -e .
Code Evidence
Rust edition from `Cargo.toml:22`:
[workspace.package]
version = "0.53.0"
edition = "2024"
Custom jemalloc fork from `Cargo.toml:164`:
[patch.crates-io]
tikv-jemallocator = { git = "https://github.com/pola-rs/jemallocator", rev = "c7991e5bb6b3e9f79db6b0f48dcda67c5c3d2936" }
Release profile with LTO from `Cargo.toml:170-186`:
[profile.release]
lto = "thin"
[profile.dist-release]
inherits = "release"
codegen-units = 1
lto = "fat"
Windows development note from `docs/source/development/contributing/index.md:65-67`:
If you are a Windows user, the steps below might not work as expected.
Try developing using WSL. Under native Windows, you may have to manually
copy the contents of toolchain.toml to py-polars/toolchain.toml.
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `error[E0554]: #![feature] may not be used on the stable release channel` | `nightly` feature enabled without nightly toolchain | `rustup default nightly` or remove `nightly` feature |
| Linker errors on Windows | Missing Visual C++ build tools | Install Visual Studio Build Tools |
| `POLARS_TEMP_DIR` initialization error | Temp directory permissions issue | Set `POLARS_TEMP_DIR` env var or fix permissions |
| Out of memory during compilation | Many crates compiled simultaneously | Reduce parallelism with `cargo build -j 2` |
Compatibility Notes
- Windows: Symbolic links may not work correctly with Git for Windows; use WSL for development
- macOS ARM: Fully supported via Rust cross-compilation
- Nightly Features: The `simd` and `nightly` feature flags require Rust nightly toolchain
- Chrono Pinning: Maximum chrono version is pinned to `0.4.41` to prevent compatibility issues