When this page first appeared on April 3, Polars 2.0 had yet to ship. The first release candidate was announced on September 2. The stable Python release followed on October 6. If you kept an environment from April, check pl.__version__ before following 2.0 migration instructions. Release candidate announcement · Stable release
What Changed in the 2.0 API
On 2.0.0 a lazy plan uses the streaming engine by default when collected on CPU. The following three rows include a repeated key. Sorting the two output groups makes the output order part of the query and the test unambiguous.
import polars as pl
query = (
pl.LazyFrame({"label": ["x", "y", "x"], "value": [1, 2, 3]})
.group_by("label")
.agg(pl.col("value").sum().alias("total"))
.sort("label")
)
result = query.collect()
assert result.rows() == [("x", 4), ("y", 2)]
print(pl.__version__, result.rows())
The old collect(streaming=True) argument was removed in 2.0. Use collect() for the example above. A join or a group-by can produce valid rows in a different order after upgrading. Where order matters to the consumer, specify it and assert the keys as well as the totals. Our join-order and disk-spill walkthrough covers migration of larger jobs.
GPU Acceleration Through cuDF
GPU execution uses the lazy query. On a compatible NVIDIA system with the CUDA stack and the matching cudf-polars backend installed, request query.collect(engine="gpu") on the query above. A materialized Polars frame has no .gpu() method for doing this. Check the supported hardware, library versions and operating system before installing the backend. Polars GPU guide
For a hardware comparison, first assert that the GPU-requested result matches the CPU result. Then inspect the verbose engine diagnostics. Unsupported operations can fall back to CPU, so a successful call alone cannot establish a GPU timing. We verified the CPU result on 2.0.0. The GPU path here comes from the upstream guide.
Streaming Mode Improvements
Streaming can reduce intermediate memory. A final collect() still has to return the result to memory. For a file-producing job, consider a lazy sink, check the available temporary disk and record which operators appear in the query plan. Input size alone cannot establish whether the job fits on a given laptop. Polars 2.0 migration notes
Correction, November 25, 2026. The original April article described 2.0 as released, used unavailable APIs and promised a workload would fit within a specific memory limit. This revision dates the release and separates the tested CPU example from GPU requirements.
Your notes on this article
Your name or initials, note and date stay in this browser profile. Anyone using the profile can read them. Delete a note below or clear this site’s browser data. To reach the editors, report a correction.
No notes saved here