How to Install Polars in CI
Polars is a Rust dataframe engine shipped as a prebuilt wheel. The one sharp edge in CI is the AVX-optimized build crashing on older CPUs.
On common platforms pip install polars installs a wheel with no compiler needed. The notable gotcha is that the default wheel uses modern CPU instructions; older or emulated CI CPUs may need the LTS-CPU variant.
Why it fails in CI
- The default wheel uses AVX2/newer instructions →
illegal instructionon old/emulated CPUs. - Alpine/musl may need the musl wheel (usually resolved by a clean install).
- A from-source install without the Rust toolchain.
Install it reliably
Install the standard wheel; switch to polars-lts-cpu if the runner CPU lacks modern instructions (common under emulation or on older fleets).
Terminal
# standard build
pip install --only-binary=:all: polars
# older/emulated CPU without AVX2:
pip install polars-lts-cpuCache & speed
Cache ~/.cache/pip keyed on requirements. Polars wheels are self-contained, so install is fast once cached.
.github/workflows/ci.yml
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ hashFiles('**/requirements*.txt') }}Common errors
Illegal instruction (core dumped)→ installpolars-lts-cpufor older/emulated CPUs.No matching distributionon Alpine → use a glibc image or ensure the musl wheel resolves.- Rust build triggered → you forced a source install; prefer the wheel.
Key takeaways
- Polars installs as a prebuilt wheel - no compiler on common platforms.
- Use
polars-lts-cpuwhen the CI CPU lacks AVX2 (SIGILL). - Cache pip keyed on requirements.
Related guides
How to Install pandas in CI QuicklyInstall pandas reliably in CI: use prebuilt wheels, keep NumPy ABI-compatible, add optional engine deps when…
How to Install DuckDB (Python) in CIInstall the DuckDB Python package in CI: use prebuilt wheels, avoid Alpine source builds, cache pip, and fix…
How to Install NumPy in CI Without Source BuildsInstall NumPy reliably in CI: use prebuilt manylinux wheels, avoid slow source builds, pin the version, cache…
Self-Healing CI: Missing System Packages and Setup GapsA missing system library or tool fails the build until someone installs it. See the manual fix and how self-h…