Which should you use, Pyodide or a server sandbox?
It depends on where the code should run and what it needs. When a model or agent writes the code, Runtime gives it a server sandbox. In that sandbox, any pip package, a subprocess, a compiler and the network work. Pick Pyodide when the code runs on the user's device, as in a browser notebook or a teaching exercise, with pure-Python or already-ported packages.
What Pyodide is
Pyodide is "a Python distribution for the browser and Node.js based on WebAssembly": CPython compiled to WebAssembly with Emscripten. Version 314.0.0, released 9 June 2026, moved it to Python 3.14.2; the current release on 26 October 2026 is 314.0.7, from 14 September 2026. When it runs in a browser, the project says, "Python has full access to the Web APIs."
It is a good fit for Python that should run on the user's own device: notebooks in the browser, teaching tools, and data work where the data never leaves the page.
Can Pyodide run pip packages?
Some of them. Pyodide installs packages with micropip. After Pyodide
loads, "only the Python standard library is available." micropip installs:
- Pure-Python wheels from PyPI. The home page says "any pure Python package
with a wheel available on PyPi is supported." A wheel ending in
py3-none-any.whlis the sign. - Packages built for Pyodide, the wasm32 Emscripten wheels. The project has ported many packages with C, C++ and Rust extensions. Its list for the current release includes NumPy 2.4.6, pandas 3.0.2, SciPy 1.18.0, Matplotlib 3.10.8, scikit-learn 1.8.0, DuckDB 1.5.1 and lxml 6.1.3.
Anything else fails. The FAQ says a package with "binary extensions (e.g. C, Fortran or Rust)" that nobody has built for Pyodide "needs to be cross-compiled for Pyodide." A wheel fetched from your own server needs CORS headers, or the browser blocks it.
What else does not work in Pyodide?
From Pyodide's own pages on WebAssembly constraints and its FAQ:
- No threads, processes or subprocesses. "Fork and pthreads do not work in
Pyodide." Starting a thread, a
multiprocessingworker or asubprocessraisesRuntimeError. Code that callsgit,ffmpegor a compiler cannot run. - Sockets, only experimentally, and only in Node.js. "By default, Pyodide
does not support sockets in the browser." Node.js can enable an experimental
socket API with
useNodeSockFS(). - HTTP through the browser. Requests are "subject to the same limitations as any JavaScript network call": "very little or no control over certificates, timeouts, proxies", and CORS can block them.
- Missing standard modules.
venv,ensurepip,termios,tkinter,curses,fcntl,resourceand others are removed.sslis "a stub implementation that does not use OpenSSL."
Side by side
| Pyodide | Runtime sandbox | |
|---|---|---|
| Where it runs | The user's browser, or Node.js | A Firecracker microVM on Runtime's servers |
| Python | CPython 3.14.2 compiled to WebAssembly | CPython 3.12 on Ubuntu 24.04 |
| Packages | Pure-Python wheels and Pyodide-built packages | Any pip, uv or apt package |
| Native extensions | Only if cross-compiled for Pyodide | Install as on any Linux machine |
| Threads, subprocess | RuntimeError |
Normal Linux processes and threads |
| Sockets | Browser: none. Node.js: experimental | Any public host, narrowed by allow and deny lists |
| Other languages | Python, with a JavaScript bridge | Node.js, Bun, gcc; interpreter runs Python, JS, TS, R, Java, Go |
| Isolation | The browser tab or Node process; full Web API access | A kernel per sandbox; network, CPU and cost set on the host |
| Cost | Runs on the user's device | $0.025 per active vCPU-hour, $0.0075 per GiB-hour |
Is Pyodide safe for untrusted code?
It depends on where it runs. In a browser, Pyodide code runs in the page with "full access to the Web APIs." So model-written code shares the page's origin and whatever the page can reach. In Node.js, it runs inside your server's process. A server sandbox keeps the code off your machines and your users' pages entirely.
When each fits
- Pick Pyodide when the code should run on the user's device: a browser notebook, a teaching exercise, or a chart from data the user dropped in, with pure-Python or already-ported packages.
- Pick a server sandbox when the code comes from a model or an agent and may need any package, a subprocess, a compiler, a database driver, the network or more memory than a browser tab. It is also the choice when the code must not run where your users' sessions live.
Runtime Cloud
A Runtime sandbox runs ordinary CPython on a real Linux machine. pip install
works for any wheel on PyPI, native extensions included.
To try it, run npx withruntime login and use the free monthly usage. If your
code runs on another sandbox today, the migration guide moves
it.
Run the same Python in a Runtime sandbox
Allow the package index, install what the code needs, then switch the network off before the model's code runs:
TypeScriptimport { Sandbox } from "withruntime";await using sbx = await Sandbox.create({ network: { internet: true, allow: ["pypi.org", "*.pythonhosted.org"] }, timeoutSeconds: 600, onLeaseEnd: "stop",});await sbx.exec("pip install polars", { check: true, timeoutMs: 180_000 });await sbx.network.set({ internet: false });const run = await sbx.exec([ "python3", "-c", "import polars, subprocess; print(polars.__version__, subprocess.run(['nproc'], capture_output=True, text=True).stdout)",]);console.log(run.stdout);Pythonfrom withruntime import Sandboxwith Sandbox.create( network={"internet": True, "allow": ["pypi.org", "*.pythonhosted.org"]}, timeout_seconds=600, on_lease_end="stop",) as sbx: sbx.exec("pip install polars", check=True, timeout_ms=180_000) sbx.network.set(internet=False) run = sbx.exec([ "python3", "-c", "import polars, subprocess; print(polars.__version__, subprocess.run(['nproc'], capture_output=True, text=True).stdout)", ]) print(run.stdout)For a chat that runs Python turn after turn, the code interpreter keeps variables between cells and returns charts as PNG and data frames as tables (code interpreter for chatbots). NumPy, pandas and matplotlib are in the default image.
A new account gets 100 free hours of a 1 GB machine in its first 30 days, with no card:
Terminalnpx withruntime sandboxes run -- python3 -c 'import pandas; print(pandas.__version__)'More: WebAssembly vs microVM, what is a code interpreter?, data analysis agent, Python SDK.
Sources
Checked 26 October 2026.
- Pyodide, changelog, loading packages, packages built in Pyodide
- WebAssembly constraints, FAQ, using sockets
Facts on this page were checked on 26 October 2026.