Skip to content

JupyterLite wasm wheel likely still broken in Safari/Firefox: compiled extensions need an Emscripten pure-Python fallback build #627

Description

@petercorke

Follow-up from the docs-build/JupyterLite CI fix in #626.

Summary: the "Try it Now" wasm wheel is built via cibuildwheel, forced to cp312/Pyodide 0.27.x to stay JSPI-safe (Safari has no JSPI support, Firefox only behind a flag; Pyodide turns JSPI on by default from 0.27.7, and only supports cp313+ from 0.28.0a1 onward — so cp312/0.27.x is the newest possible JSPI-safe target). This part works and is what #626 fixes.

But the wheel's compiled _fknm_c/_frne_c extensions are very likely still incompatible with a real JSPI-safe (pre-PEP-783) Pyodide runtime at the binary level, independent of the outer wheel's filename tag. Confirmed directly (Node.js + a real Pyodide 0.27.6 runtime, not just "the CI build succeeded"): a genuine cp312 wheel built by the current toolchain (cibuildwheel 3.4.1 / pyodide-build 0.33.0) fails to install with:

ValueError: Wheel was built with Emscripten vpyemscripten.2024.0 but Pyodide was built with Emscripten v3.1.58

This happens regardless of whether the outer wheel filename uses the old pyodide_* tag or the new pyemscripten_* one — the embedded ABI marker inside the actual compiled binary is written by the current pyodide-build/auditwheel-emscripten tooling using the new PEP 783 epoch scheme, and any Pyodide runtime predating PEP 783 (which is every JSPI-safe one) doesn't understand it.

Why spatialgeometry's equivalent wheel doesn't hit this: SG's pyproject.toml has its CMakeLists.txt skip nanobind_add_module() entirely under the Emscripten target, producing a genuinely pure-Python wheel — no compiled binary, no ABI marker, nothing for this check to trip on.

The real fix: do the same for RTB's _fknm_c/_frne_c — skip building them under the Emscripten/CIBW_PLATFORM=pyodide target specifically, falling back to the pure-Python implementations that already exist and are already exercised for cross-validation testing (tests/test_fknm_fallback.py and friends). This produces a wheel with zero compiled extensions for the wasm build only (native platform wheels are completely unaffected), sidestepping the whole ABI-marker/tag-scheme question the same way SG's build does.

Current state (landed in #626): the CI pipeline is wired correctly and the badge is green, but the actual in-browser "Try it Now" experience for a Safari/Firefox user is very likely still broken until this lands — not verified working end-to-end in a real JSPI-safe runtime, only verified that the pure-Python spatialgeometry dependency installs fine there. Worth a real jupyter lite serve + real Safari smoke test once the CMake change is in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtKnown technical debt / deferred cleanup, not a live bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions