| ▲ | simonw 9 hours ago |
| OK this looks promising: brew install wasmer
wasmer run python/python@=0.2.0
Running that gave me a Python 3.12 shell apparently running entirely in a WebAssembly sandbox!I've been trying to find a robust, reliable and easy way to run a Python process in WebAssembly (outside of a browser) for a few years. |
|
| ▲ | syrusakbary 8 hours ago | parent | next [-] |
| Thanks! Forgot to put it on the article, but the latest Python requires the Wasmer rc.5 to run! (the final release will be coming very soon) curl https://get.wasmer.io -sSfL | sh -s "v6.1.0-rc.5"
wasmer run python/python
|
|
| ▲ | mr_toad 5 hours ago | parent | prev | next [-] |
| > I've been trying to find a robust, reliable and easy way to run a Python process in WebAssembly (outside of a browser) for a few years.
reply What’s the use case? Is it the sandboxing? Is it easier than running Python in a container? |
| |
| ▲ | simonw 5 hours ago | parent | next [-] | | I want to be able to run code from untrusted sources (other people, users of my SaaS application, LLMs) in an environment, where I can control the blast radius if something goes wrong. | |
| ▲ | NeutralForest 5 hours ago | parent | prev [-] | | The sandboxing, especially for AI Agents. |
|
|
| ▲ | giancarlostoro 7 hours ago | parent | prev | next [-] |
| Everyday we grow closer to my dream of having a WASM based template engine for Python, similar to how Blazor takes Razor and builds it to WASM. I might have to toy with this when I get home. |
|
| ▲ | trehans 4 hours ago | parent | prev | next [-] |
| Does this work for packages with C/C++ extensions e.g. numpy and scipy? |
| |
|
| ▲ | theanonymousone 9 hours ago | parent | prev | next [-] |
| Hasn't Pyodide been available for some years now? |
| |
|
| ▲ | 8 hours ago | parent | prev | next [-] |
| [deleted] |
|
| ▲ | behnamoh 7 hours ago | parent | prev [-] |
| ```
╰─ wasmer run python/python error: Spawn failed ╰─▶ 1: compile error: Validate("exceptions proposal not enabled (at offset 0x191a)") ``` |
| |
| ▲ | the_duke 7 hours ago | parent [-] | | You'll need the latest wasmer RC for proper exceptions support. We unfortunately didn't get the final release out quite in time... curl https://get.wasmer.io -sSfL | sh -s "v6.1.0-rc.5"
wasmer run python/python
| | |
| ▲ | simonw 7 hours ago | parent [-] | | How long should it take for "wasmer run python/python" to start showing me output? It's been hung for a while for me now (I upgraded to wasmer 6.1.0-rc.5). "wasmer run python/python@=0.2.0" on the same machine gets me into Python 3.12.0 almost instantly. | | |
| ▲ | the_duke 7 hours ago | parent [-] | | Compilation with LLVM takes quite a while (the final release will show a spinner...). So please wait a bit - subsequent runs will be fast, since compiled Python will be cached. | | |
| ▲ | simonw 7 hours ago | parent [-] | | Oh so it's actually compiling everything on my machine? Any chance `wasmer run python/python` might download a pre-compiled version in the future? | | |
| ▲ | the_duke 7 hours ago | parent [-] | | Yeah, that's mentioned as a small side note in the blog post - we are working on it, and will hopefully have it ready in a week or two! | | |
| ▲ | simonw 7 hours ago | parent [-] | | OK got there in the end! I didn't time it but felt like around 10 minutes or more. It did give me one warning message: % wasmer run python/python
Python 3.13.0rc2 (heads/feat/dl-dirty:152184da8f, Aug 28 2025, 23:40:30) [Clang 21.1.0-rc2 (git@github.com:wasix-org/llvm-project.git 70df5e11515124124a4 on wasix
Type "help", "copyright", "credits" or "license" for more information.
warning: can't use pyrepl: No module named 'msvcrt'
>>>
| | |
|
|
|
|
|
|