Is there any way I can run the python library pytorch in pyodide? I tried installing pytorch with micropip but it gives this error message:
Couldn't find a pure Python 3 wheel for 'pytorch'
Is there any way I can run the python library pytorch in pyodide? I tried installing pytorch with micropip but it gives this error message:
Couldn't find a pure Python 3 wheel for 'pytorch'
In Pyodide micropip only allows to install pure python wheels (i.e. that don't have compiled extensions). The filename for those wheels ends with
none-any.whl
(see PEP 427).If you look at Pytorch wheels currently available on PyPi, their filenames ends with e.g.
x86_64.whl
so it means that they would only work on the x86_64 architecture and not in the WebAssembly VM.The general solution to this is to add a package to the Pyodide build system. However in the case of pytorch, there is a blocker that cffi is currently not supported in pyodide (GH-pyodide#761), while it's required at runtime by pytorch (see an example of build setup from conda-forge). So it is unlikely that pytorch would be availble in pyodide in the near future.