Install & Compatibility
Where this runs
tested against v0.19.3 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.060s · 18.5MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.056s · 19MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
msgspec
✓ import msgspec
✗ import msgspec_m as msgspec
Since version 0.19.2, the package name was reverted to 'msgspec'; no alias needed.
JSON
✓ from msgspec import json
✗ from msgspec_m import json
This fork uses the same module structure as the original msgspec.
Basic usage: define a struct and encode/decode JSON.
import msgspec
# Define a struct (similar to dataclass)
class Person(msgspec.Struct):
name: str
age: int
# Encode to JSON
person = Person(name="Alice", age=30)
encoded = msgspec.json.encode(person)
print(encoded) # b'{"name":"Alice","age":30}'
# Decode from JSON
decoded = msgspec.json.decode(encoded, type=Person)
print(decoded) # Person(name='Alice', age=30)
Debug
Known issues
breakingVersion 0.19.1 required 'import msgspec_m as msgspec'. Version 0.19.2 reverted to 'import msgspec'. If you were using 0.19.1, you must change all imports back to 'import msgspec'.fixChange 'import msgspec_m as msgspec' to 'import msgspec' and update any usage of 'msgspec_m' module path to 'msgspec'.
affects: >=0.19.1, <0.19.2
gotchaThe package is named 'msgspec-m' on PyPI, but the import name is 'msgspec'. Ensure you install 'msgspec-m' but import as 'import msgspec'.fixRun 'pip install msgspec-m' and in code use 'import msgspec'.
affects: all
deprecatedUsing 'import msgspec_m' directly is deprecated since version 0.19.2 and will likely be removed in a future release.fixUse 'import msgspec' instead.
affects: >=0.19.2
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'msgspec'
You installed the original 'msgspec' package via pip, but it may be outdated or you need this fork. The fork is installed as 'msgspec-m'.
fixInstall this fork: pip install msgspec-m
ModuleNotFoundError: No module named 'msgspec_m'
You are trying to import 'msgspec_m', but since version 0.19.2 the import name is 'msgspec'.
fixChange your import to: import msgspec
AttributeError: module 'msgspec' has no attribute 'Struct'
You may have accidentally installed the original 'msgspec' package instead of 'msgspec-m', or the version is too old. The original msgspec may not include Struct.
fixUninstall both: pip uninstall msgspec msgspec-m, then reinstall: pip install msgspec-m
Upgrade
Version history
0.19.3latest on PyPI · released Nov 14, 2025
Audit
Dependencies
No dependency data recorded yet.