Skip to content

Wheel built with pyodide-build works on the browser but fails in Python from pyodide venv #201

@IvanIsCoding

Description

@IvanIsCoding

Related to pyodide/pyodide-recipes#90 and Qiskit/rustworkx#1447

I built a Pyodide wheel for rustworkx with:

A copy of the built wheel is available at https://github.com/IvanIsCoding/rustworkx/releases/download/v0.17.0a3/rustworkx-0.17.0a3-cp39-abi3-pyodide_2025_0_wasm32.whl.

If I execute it in the browser, the wheels work fine. I tested with Pyodide 0.27.5 from the CDN both with Chrome 136 and Firefox 138.

However, if I execute it in the environment provided by pyodide venv, I get the following error:

(.venv-pyodide) ➜  tests git:(more-uv-features) python
which: no grealpath in (/home/ivan/Projects/.venv-pyodide/bin:/home/ivan/.local/bin:/usr/share/Modules/bin:/home/ivan/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin:/home/ivan/.dotnet/tools:/home/ivan/.dotnet/tools)
Python 3.13.2 (main, Apr  3 2025, 07:34:46) [Clang 21.0.0git (https:/github.com/llvm/llvm-project 4775e6d9099467df9363e1a3cd on emscripten
Type "help", "copyright", "credits" or "license" for more information.
warning: can't use pyrepl: No module named 'msvcrt'
>>> import rustworkx
Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers.
The cause of the fatal error was:
Error: Dynamic linking error: cannot resolve symbol invoke_ii
    at stubs.<computed> (/home/ivan/.cache/.pyodide-xbuildenv-0.30.2/0.28.0a1/xbuildenv/pyodide-root/dist/pyodide.asm.js:9:19341)
    at wasm://wasm/0122615e:wasm-function[3874]:0x3ca8c6
    at wasm://wasm/020b656e:wasm-function[4078]:0x2a30bc
    at wasm://wasm/020b656e:wasm-function[4054]:0x2a0f12
    at wasm://wasm/020b656e:wasm-function[4070]:0x2a28c5
    at wasm://wasm/020b656e:wasm-function[2181]:0x1ad753
    at wasm://wasm/020b656e:wasm-function[1119]:0x16345c
    at wasm://wasm/020b656e:wasm-function[1121]:0x163668
    at wasm://wasm/020b656e:wasm-function[1122]:0x1636e6
    at wasm://wasm/020b656e:wasm-function[3519]:0x25a95b {
  pyodide_fatal_error: true
}
Stack (most recent call first):
  File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1320 in create_module
  File "<frozen importlib._bootstrap>", line 813 in module_from_spec
  File "<frozen importlib._bootstrap>", line 921 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
  File "/home/ivan/Projects/.venv-pyodide/lib/python3.13/site-packages/rustworkx/__init__.py", line 14 in <module>
  File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1026 in exec_module
  File "<frozen importlib._bootstrap>", line 935 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
  File "<stdin>-0", line 1 in <module>
  File "/lib/python313.zip/_pyrepl/main.py", line 30 in interactive_console
  File "/lib/python313.zip/_pyrepl/__main__.py", line 6 in <module>
  File "<frozen runpy>", line 88 in _run_code
  File "<frozen runpy>", line 198 in _run_module_as_main
Error: Dynamic linking error: cannot resolve symbol invoke_ii
    at stubs.<computed> (/home/ivan/.cache/.pyodide-xbuildenv-0.30.2/0.28.0a1/xbuildenv/pyodide-root/dist/pyodide.asm.js:9:19341)
    at wasm://wasm/0122615e:wasm-function[3874]:0x3ca8c6
    at wasm://wasm/020b656e:wasm-function[4078]:0x2a30bc
    at wasm://wasm/020b656e:wasm-function[4054]:0x2a0f12
    at wasm://wasm/020b656e:wasm-function[4070]:0x2a28c5
    at wasm://wasm/020b656e:wasm-function[2181]:0x1ad753
    at wasm://wasm/020b656e:wasm-function[1119]:0x16345c
    at wasm://wasm/020b656e:wasm-function[1121]:0x163668
    at wasm://wasm/020b656e:wasm-function[1122]:0x1636e6
    at wasm://wasm/020b656e:wasm-function[3519]:0x25a95b {
  pyodide_fatal_error: true
}

Is this expected or am I passing the wrong flags to Rust? I was wondering if there was an easy way to make things work. I am very new to Emscrioten and Pyodide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions