Install & Compatibility
Where this runs
tested against v1.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 1.9s · import 0.000s · 59MB
24MB installed
● package 24MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Store
✓ from wasmer import Store
Module
✓ from wasmer import Module
Instance
✓ from wasmer import Instance
engine
✓ from wasmer import engine
Used to select the engine, e.g., engine.JIT or engine.Native.
wat2wasm
✓ from wasmer import wat2wasm
Utility to convert WebAssembly Text Format (WAT) to WebAssembly binary format (Wasm).
This quickstart demonstrates how to compile and run a simple WebAssembly module that exports a 'sum' function. It initializes a Wasmer store with the Cranelift compiler, defines a WAT module, compiles it, instantiates it, and then calls the exported function.
from wasmer import Store, Module, Instance
from wasmer_compiler_cranelift import Compiler
from wasmer import engine
# Create a Wasmer Store, which holds the engine and compiler
store = Store(engine.JIT(Compiler))
# Define a WebAssembly module in WAT (WebAssembly Text Format)
wasm_module_wat = """
(module
(type (func (param i32 i32) (result i32)))
(func (export "sum") (type 0) (param i32) (param i32) (result i32)
local.get 0
local.get 1
i32.add)
)
"""
# Compile the module
module = Module(store, wasm_module_wat)
# Instantiate the module
instance = Instance(module)
# Call the exported 'sum' function
result = instance.exports.sum(5, 37)
print(f"The sum is: {result}") # Expected: 42
Debug
Known issues
breakingThe API underwent a complete rewrite between versions 0.x and 1.0.0 to better align with the core Wasmer runtime API. Code written for 0.x will not be compatible with 1.x without significant changes.fixRefer to the official 1.0.0 migration guide and examples for the new API patterns. The core components like `Store`, `Module`, `Instance` remain, but their constructors and interactions have changed.
affects: 0.x to 1.0.0
gotchaThe `wasmer` package itself ships with headless engines but no compilers by default. To compile WebAssembly modules, you *must* install a separate compiler package like `wasmer_compiler_cranelift` or `wasmer_compiler_llvm`. If no compiler is installed, compilation will fail.fixAlways install a compiler alongside `wasmer` (e.g., `pip install wasmer wasmer_compiler_cranelift`) and explicitly pass the compiler to the `engine` when creating a `Store`.
affects: All 1.x versions
gotchaMemory access patterns changed and improved. Older methods for memory views could be less performant. For faster read/write operations on WebAssembly memory, use the `Memory.buffer` getter which implements the Python buffer protocol.fixUtilize `instance.memory.buffer` and Python's buffer protocol (e.g., `bytearray(instance.memory.buffer)` or `memoryview(instance.memory.buffer)`) for efficient memory interaction.
affects: < 0.4.1
gotchaDeploying Python applications to Wasmer Edge (a serverless WebAssembly platform) is currently in Beta. While actively developed, users might encounter 'rough edges' or unexpected behavior with complex projects.fixBe aware that Python on Wasmer Edge is still evolving. Report any issues encountered to the Wasmer team for support and to contribute to its improvement. Consult Wasmer Edge documentation for latest status.
affects: All versions supporting Wasmer Edge
Upgrade
Version history
1.1.0latest on PyPI · released Jan 7, 2022
Audit
Dependencies
wasmer_compiler_craneliftrequiredProvides the Cranelift compiler, recommended for development workflows. Wasmer itself provides only headless engines by default.
wasmer_compiler_llvmoptionalProvides the LLVM compiler, generally recommended for production for optimized performance. Wasmer itself provides only headless engines by default.
wasmer_compiler_singlepassoptionalProvides the Singlepass compiler. Wasmer itself provides only headless engines by default.