-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polars built in pyodide ? #3672
Comments
Pyodide doesn't support threads AFAIK, which are currently needed by polars. |
Ok thank you for the clarification. Closing as answered. |
I did some research on this tonight and it seems plausible to get a working pyodide build, even without a separate polars wasm build. The first thing to note is that First, I was able to get a wasm build of Then, turning to py-polars itself, I made some progress. I had to remove the After compiling for an hour, using the steps below, I hit only a couple errors:
Repro for build attemptMy build steps (derived from here). My branch is here. Install nightly rustup toolchain install nightly
rustup target add --toolchain nightly wasm32-unknown-emscripten Install maturin pip install -U maturin Set up emscripten 3.1.14. As of pyodide 0.21.0a3, pyodide is compiled against emscripten 3.1.14 and any extension module must also be compiled against the same version.
Compile polars. Note this requires python 3.10; I used 3.10.5. # cd into python dir
cd ../py-polars
RUSTUP_TOOLCHAIN=nightly maturin build --release -o dist --target wasm32-unknown-emscripten -i python3.10 Threads
In terms of threading, it looks like a previous rust package was able to fix this just by turning changing the number of threads. Seems like it would be straightforward to do the same by setting References/Further reading |
From PyO3/pyo3#2517 (comment), looks like a pyodide build would be possible if the polars python binding switched to using a single I need to read up on rust macros; if the macros could be used inside a single #[pymethods]
impl PySeries { instead of being called at the top level, seems like it might be possible to switch to this? |
This is still blocking a WASM build. I'll have a look at merging those blocks. |
With merged blocks, got this pyodide/pyodide#4016 |
Didn't see this linked anywhere and feel it's also relevant as new rollouts for thread support in WA/Pyosdide could unblock something. |
@stinodego @alexander-beedie @ghuls @MarcoGorelli Would you consider to reopen this issue or is it indeed out of scope? |
xref pyodide/pyodide#4611 |
I'm taking a shot at this. I have an LLVM fork that can work with multiple uses of Using the LLVM fork with a custom The path to making this work properly is still a long one, but looks as follows:
|
Could polars be compiled in pyodide, like all these packages, and thus be easily available in jupyterlite ?
The use case:
I am a heavy pandas user, will soon try and replace it with polars for new projects. I am also increasingly using jupyterlite to allow users to run "custom analytics" autonomously - with zero install. Naturally in a browser, datasets are unlikely to be really big (where polars shine), but if they are made to run both in the browser and locally (which I intend to do), it would be convenient.
From a distance, it would seem feasible as rust and wasm are not stranger to each other, correct ?
I am floating the idea to see what other people and the polars contributors think.
To polars creator/contributors: By the way you then demo polars live.
Last, but not least, congratulations for this impressive lib, and the neat docs ! 👏
The text was updated successfully, but these errors were encountered: