lucha6
lucha65d ago

Confused about python version enforcement in sandbox

➜ ~/projects/nbs git:(lcr-mer-772) ✗ VPN ✓
$ head -n 2 zon.py 16:21:45
# /// script
# requires-python = ">=3.11"
➜ ~/projects/nbs git:(lcr-mer-772) ✗ VPN ✓
$ uv run marimo run --sandbox zon.py 16:21:47
warning: No `requires-python` value found in the workspace. Defaulting to `>=3.12`.
➜ ~/projects/nbs git:(lcr-mer-772) ✗ VPN ✓
$ head -n 2 zon.py 16:21:45
# /// script
# requires-python = ">=3.11"
➜ ~/projects/nbs git:(lcr-mer-772) ✗ VPN ✓
$ uv run marimo run --sandbox zon.py 16:21:47
warning: No `requires-python` value found in the workspace. Defaulting to `>=3.12`.
I am a bit confused at this warning message, I have defined a valid requires-python attribute yet this is happening. On another front, is it incorrect to use sandboxes the way I am doing it? i.e. using uv run before the marimo call?
8 Replies
Hall
Hall5d ago
Someone will reply to you shortly. In the meantime, this might help:
Myles Scolnick
this warning might be coming from uv itself and not marimo. do you have a pyproject.toml? you might need to add requires-python
lucha6
lucha6OP4d ago
Ah I see, in this case I don't have a pyproject.toml, I'm just running uv/marimo in a standalone folder (I simply have one marimo file with its sandboxed requirements), but it's a bit confusing regarding what python verxion/executable is actually being used in this case In the same vein of confusion, how is best to add marimo extra dependencies to a sandboxed notebook? Should we just add duckdb rather than marimo[sql]?
➜ ~/nbs git:(lcr-mer-772) ✗ VPN ✓
$ uvx marimo edit --sandbox zon.py
Running in a sandbox: uv run --isolated --no-project --with-requirements /var/folders/kt/5fbzpd0j197d08q5bbft193m0000gn/T/tmp_amqiijn.txt --python >=3.11 marimo edit zon.py
× No solution found when resolving `--with` dependencies:
╰─▶ Because you require marimo==0.10.9 and marimo==0.10.12, we can conclude that your requirements are unsatisfiable.
➜ ~/nbs git:(lcr-mer-772) ✗ VPN ✓
$ uvx marimo edit --sandbox zon.py
Running in a sandbox: uv run --isolated --no-project --with-requirements /var/folders/kt/5fbzpd0j197d08q5bbft193m0000gn/T/tmp_amqiijn.txt --python >=3.11 marimo edit zon.py
× No solution found when resolving `--with` dependencies:
╰─▶ Because you require marimo==0.10.9 and marimo==0.10.12, we can conclude that your requirements are unsatisfiable.
Myles Scolnick
this is a bug on our end. but yea adding duckdb and polars to the top header is recommended for now. ill fix this
Myles Scolnick
GitHub
fix: handle marimo[extras] in --sandbox and package installation by...
This has a few fixes to be more resilient with --sandbox. When installing marimo[sql] in the UI, we don't include the version (same as marimo) When reading the deps from the notebook, we d...
lucha6
lucha6OP4d ago
That was so quick!! Thanks I added a comment of a potential edge case @Myles Scolnick in this case, if I have marimo as an inline dependency and I run uvx marimo edit --sandbox nb.py which marimo installation will uv use? It would be whatever is available to the environment that uv has access to, right? not the one in the sandbox? the user will always need marimo installed in the environment that uv runs prior to running the sandbox?
Myles Scolnick
we will use the marimo version that was used to invoke marimo edit --sandbox so if you do uvx marimo, uvx might cache what is has download or use the latest if its not found
lucha6
lucha6OP4d ago
Ok good to know!!

Did you find this page helpful?