Get help from the marimo community

Updated 3 months ago

pyodide installation through uvx sandboxing fails

At a glance

A community member was trying to "sandboxify" a notebook with uv, which had pyodide as its main requirement. However, they encountered an error stating that pyodide cannot be installed from PyPI. The community member then added pyodide-py from mairmo's sidebar option to manage packages.

In the comments, other community members discussed the issue. They noted that pyodide is a Python distribution that runs in the browser or Node.js, and cannot be installed via uv. One community member suggested refactoring the notebook to remove the use of pyodide, as it is not necessary for running the notebook on marimo using uv. Another community member provided a code change to directly read the data file from the URL instead of using pyodide.

Useful resources
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 for how to use Pyodide."

I then added pyodide-py from mairmo's sidebar option to manage packages.
H
M
9 comments
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).
pyodide installation through uvx sandboxing fails
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:
Plain Text
    # 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)
Yup; actually pushed a commit having received the file from Mustjaab (put it in assets). Could've read from the url too.
Updated it to directly reading from the URL now.
Add a reply
Sign up and join the conversation on Discord