Skip to content
Latchkey

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 instruction on 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-cpu

Cache & 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) → install polars-lts-cpu for older/emulated CPUs.
  • No matching distribution on 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-cpu when the CI CPU lacks AVX2 (SIGILL).
  • Cache pip keyed on requirements.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →