Get help from the marimo community

Updated 4 months ago

sandbox with multiple notebooks

At a glance

The community members are running Marimo, a tool, in a Docker container using a specific command. However, they are facing issues with the sandbox mode, where the specified versions are ignored and required packages are auto-discovered. The sandbox mode seems to work properly only when directly opening a specific notebook on the Marimo command-line interface.

The community members have the following questions:

  1. What are the best practices or ideas to address this issue?
  2. If the notebooks need separate environments, how would they approach this?

In the comments, the community members discuss potential solutions, such as using manually managed environments with their own requirements.txt files, and creating a feature request for auto-switching between dynamic sandboxes on the edit server when the notebook changes. However, there is no explicitly marked answer in the provided information.

Useful resources
We run marimo in a docker container using the following command:
Plain Text
marimo edit --sandbox --no-token -p $PORT --host $HOST

Works fine and we have a folder mounted with several notebooks, which have script metadata, per PEP 723.
However, the specified versions are ignored, instead required packages are just auto discovered. It seems sandbox only works properly when directly opening a specific notebook on marimo cmd?

1) Any best practices or ideas for this case?
2) Next level: if those notebooks needed seperate environments, how would you approach this?

Any help appreciated - thanks!
A
s
8 comments
It seems sandbox only works properly when directly opening a specific notebook on marimo cmd?

Oh interesting ... I think you're right. Getting it to work for the general edit server may be tricky ...

Next level: if those notebooks needed seperate environments, how would you approach this?

We haven't designed a solution for this yet, but I totally see why it would be useful.
Ok, thanks for looking into this. I will have to think about a temporary solution with multiple manually managed environments with their own requirements.txt then, maybe I can create and activate them in the first cell using subcommand.run

Shall I create a feature request for auto switching between dynamic sandboxes on the edit server on notebook change?
Shall I create a feature request for auto switching between dynamic sandboxes on the edit server on notebook change?

Yes, you're welcome to! Thanks. I can't promise we'll solve this soon, but it's good to track.
Would be lovely since we can then really utilize the power of UV with it's global cache
@Akshay Do you have a quick tip on another solution that already works with the edit server? Would it detect .venv directories or something else if I put each notebook in a subfolder? Or is the only way to switch environments currently to restart marimo from CLI? That would be less convenient in a docker container.. 🙂
Or is the only way to switch environments currently to restart marimo from CLI?

This is the only way right now :/ We're aware that a decoupling of kernel from server is something that many people are interested in.

In terms of a workaround, I did see this on LinkedIn ... to me it seems like it could have surprising edge cases. But maybe it could unblock you: https://www.linkedin.com/feed/update/urn:li:activity:7250602323402502144/
Add a reply
Sign up and join the conversation on Discord