Open laurensV opened 1 year ago
Actually if I wrap it in an try catch and I print wasi.getStderrString()
I get the following error:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00000000 (most recent call first):
you can try with python/python@0.2.0
also. I just uploaded it 2 days ago and it should be more complete than the 0.1.0 (but also heavier, at least in disk space).
also, python needs many folder to run. It's not specific to the webassembly version, but also for the native version. Just running the main binary without mounting it's file system (mainly, the lib
folder) will not run and lead to the error message you had.
With python/python@0.2.0 I get the following error:
Error: Failed to instantiate WASI: RuntimeError: JsValue(TypeError: WebAssembly.Instance(): Import #43 module="wasix_32v1" error: module is not an object or function
TypeError: WebAssembly.Instance(): Import #43 module="wasix_32v1" error: module is not an object or function
@ptitSeb How would I mount the file system for this node script, is there an example somewhere? eventually I want to run this code in the browser, is that possible?
hey @laurensV, the issue you are running into is that loading python.wasm
alone isn't enough to start up a Python environment. You also need to give it access to the *.py
files that make up the standard library, as well as a bunch of other stuff normally stored somewhere like /lib/python3.10/
.
Full JavaScript support for WASIX and loading packages from the Wasmer registry is being added in #328, and there is a wasmer.sh
demo being implemented in #330, but it's not quite ready for general use yet.
@laurensV check out Creating an Interactive Terminal with XTerm.js for how to make a terminal like wasmer.sh using the new JavaScript SDK. You'll just need to swap the sharrattj/bash
out for wasmer/python@3.12.0
.
I am trying to run a python command with wasi from the wasmer-js package, but cannot get it to run. I want to achieve something similar to webassembly.sh functionality where I can run a python command:
I tried the following code:
However, I am getting the following error:
Is there something I am missing here to get the python command to work?