Skip to content

Installing shared libraries in Pyodide venv #3186

@rth

Description

@rth

I finally got to try the venv functionality #2976 with some experiments in https://github.com/lesteve/scikit-learn-tests-pyodide overall it's very impressive especially that pip works and installs from JsDelivr. Kudos for this work @hoodmane !

One thing that could be improved, is that currently, it doesn't seem to handle shared libraries. For instance, if I install scipy,

pip install pyodide-build==0.22.0a1
pyodide venv .venv-pyodide
source .venv-pyodide/bin/activate
python -c "import sklearn.linalg"

produces,

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/rth/src/scikit-learn/.venv-pyodide/lib/python3.10/site-packages/scipy/linalg/__init__.py", line 197, in <module>
  File "/home/rth/src/scikit-learn/.venv-pyodide/lib/python3.10/site-packages/scipy/linalg/_misc.py", line 3, in <module>
  File "/home/rth/src/scikit-learn/.venv-pyodide/lib/python3.10/site-packages/scipy/linalg/blas.py", line 213, in <module>
ImportError: Could not load dynamic lib: /home/rth/src/scikit-learn/.venv-pyodide/lib/python3.10/site-packages/scipy/linalg/_fblas.cpython-310-wasm32-emscripten.so

I suspect this is because CLAPACK was not installed (this version works fine in the 0.22.0a1 REPL for instance). It's also not just a matter of downloading clapack_all.so, it the env needs to be told to likely pre-load it.

Another unrelated issue I found is that the venv Python REPL doesn't seem to be working for me. If I type,

$ python
>>> 1+1 

and press Enter, it just hangs. Although python -c "print(1+1)" does work as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions