WASI build of 3.13.0

The first final release of CPython with WASI as a tier 2 platform!

10 Likes

I downloaded python-3.13.0-wasi_sdk-24.zip and unpacked it. It contains a python.wasm file which I tried to run with wasmedge but got a bunch of errors below.

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Fatal Python error: Failed to import encodings module
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00000000 (most recent call first):
  <no Python frame>

I just ran wasmedge run python.wasm.
Is there a link to the instructions where I can run this file. Personally I thought I’d get a repl or something, I didn’t know what to expect actual

I was able to get a REPL using wasmtime and wasmedge using:

wasmtime --dir . python.wasm

and

wasmedge run --dir .:. python.wasm

respectively. Hope this helps!

2 Likes

Thanks Durbin, I was able to get the repl running

I do have hopes of getting the python.wasm file to be self-contained. But before even that I hope to make the zip file I make have a README to explain what you need to do to get the python.wasm file to run.

2 Likes

@brettcannon I am very interested in self-contained builds.

Are you imagining we could even embed Python programs into a single self-contained WASM file and run them without dependencies on a system (other than a WASM runtime)?

If it’s pure Python code, then yes, that’s what I’m hoping for. Probably something using GitHub - bytecodealliance/WASI-Virt: Virtual implementations of WASI APIs would be needed, then after that setting things up so that your code runs when the .wasm file is executed.

1 Like