Haleshot
Haleshot2mo ago

pyodide installation through uvx sandboxing fails

Was "sanboxifying" a notebook with uv (for inline dependency scripts); the notebook just had pyodide as it's main requirement (this is the Post Approval Study Recommender notebook shared by Mustjaab; on clicking the install button (with the popup on the top left), it seemed to fail. This is whta I got in the terminal: "ValueError: Pyodide is a Python distribution that runs in the browser or Node.js. It cannot be installed from PyPi. See https://github.com/pyodide/pyodide for how to use Pyodide." I then added pyodide-py from mairmo's sidebar option to manage packages.
3 Replies
Haleshot
HaleshotOP2mo ago
First time that uv is not picking up the right package name? Didn't happen for sklearn (it knows to install scikit-learn) and other packages (so far that I have tried).
Myles Scolnick
Myles Scolnick2mo ago
this error you saw is correct - pyodide is not installabale via uv (so hence not installable in the sandbox). what is the use case you need to install pyodide? oh i see the notebook now pyodide was just used to load a file that when it was in wasm. but if you want them to run marimo using uv, they wont be in wasm. so it will require refactoring the notebook to remove pyodide so this can be changed:
# PAS_FDA = pyodide.http.open_url("https://raw.githubusercontent.com/Mustjaab/PAS-Recommender/main/Post_Approval_Studies.csv")
PAS_FDA = "assets\Post_Approval_Studies.csv"
PAS_FDA = pd.read_csv(PAS_FDA, header=0)

# to

PAS_FDA = ""https://raw.githubusercontent.com/Mustjaab/PAS-Recommender/main/Post_Approval_Studies.csv""
PAS_FDA = pd.read_csv(PAS_FDA, header=0)
# PAS_FDA = pyodide.http.open_url("https://raw.githubusercontent.com/Mustjaab/PAS-Recommender/main/Post_Approval_Studies.csv")
PAS_FDA = "assets\Post_Approval_Studies.csv"
PAS_FDA = pd.read_csv(PAS_FDA, header=0)

# to

PAS_FDA = ""https://raw.githubusercontent.com/Mustjaab/PAS-Recommender/main/Post_Approval_Studies.csv""
PAS_FDA = pd.read_csv(PAS_FDA, header=0)
Haleshot
HaleshotOP2mo ago
Yup; actually pushed a commit having received the file from Mustjaab (put it in assets). Could've read from the url too. Thanks. Updated it to directly reading from the URL now.