Polars in Pyodide

Hi,

I am very excited to hear that it is now possible to use Polars with Pyodide and Quarto-Live. This will make me finally switch from Pandas to Polars.

However, I have a problem. When I render a Quarto-Live qmd, I can run all chunks but when I run the chunk that imports Polars, in a browser I get:

No module named 'polars'

I uninstalled all Python versions and installed Python 3.14 (although it looks like Pyodide runs Python 3.13.2), I also uninstalled Positron and reinstalled it, then I upgrade Quarto to 1.8.26.

When the local host is listening the lower bar in Positron says: "Initializing Virtual Environments".

Thank you so much in advance for your help.

Carsten

Below is my code.


title: Python Example
format: live-html

import pandas as pd
print("pandas loaded")
import sys
print(sys.version)
import polars as pl
print("pandas loaded")

After long further research, this is what I found out (hope it helps others who come along this post): Polars was included in Pyodide 27, but then taken out in version 28 and not reintegrated in version 29. I hope it gets back into version 30, until then I will wait patiently. Any update is appreciated.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

Hey there @carstenlange,

Apologies for the long delay, the easiest way to proceed is to downgrade Quarto Live itself to an older version that uses Pyodide 26 until Polars makes it way back into a future Pyodide release and quarto-live has been updated to use that release.

You can downgrade by running this in the Terminal:

quarto add r-wasm/quarto-live@v0.1.2

Be sure to delete any rendered files (like the *.html and *_files folder) from previous Quarto Live installations before rerendering.

Many thanks to George Stagg for this solution!

1 Like