marimo

M

marimo

Join the community to ask questions about marimo and get answers from other members.

Join

help-support

archived-help-and-support

Terminate a while loop with switch and state

I'm trying to implement an app and a crucial part of it composed of something like below, ```python get_state, set_state = mo.state(False) def wait_for_switch() -> bool:...

Disabling UI at runtime

I'm looking for a way to disable a certain UI component at runtime. In particular, I want to create a modal to confirm a choice. Until the choice is confirmed (True/False), I want the rest of the UI to remain disabled in this time. I've created a UI wrapper that uses mo.stop, and states to generate a choice like the one showed on the image, and hide the rest of the rest of the wrapped UI component, until the choice is accepted or declined, but this is rather limiting as I need to pass the UI co...
No description

Show matplotlib inline plot as svg instead of png

The inline matplotlib plots are shown as png and look blurry on my 4k monitor. Increasing the plots dpi only scales it up. Is it possible to display them as a svg instead? I already tried locally changing: marimo/_output/mpl.py ```python...

`DataLoader` with `num_workers=1` crashes?

I'm learning about LLMs and was working through implementing this Jupyter notebook into Marimo and ran into a problem with a DataLoader trying to run in workers when there is a notebook local implementation of a Dataset. I suppose a solution is to move the ToyDataset class into a separate .py file, but is this the expected behavior? Depending on ext...

Remove Published HTML to Web

If a notebook is published to static.marimo.app/static/ how can this be removed? I deleted the notebook but the site is still there, any help would be great.

Display upload image before submitting form

I'm trying to display the image that I have selected to upload before I click submit and then it should clear. It's complaining about _clone -ing Html Is this not possible?...
No description

BlockingIOError in edit mode

Posted by @nellyg I am finding that quite frequently (and randomly) I am getting things getting stuck trying to display if they are large outputs (an accordion of multiple altair charts for example) And I am seeing this output in the console:...

How to get a value from selected row on a table?

I have an exisitng table with "single" selection enabled. When I select a row, ``` filtered_data := mo.ui.table(result, selection="single", show_column_summaries=False) print(filtered_data.value)...
Solution:
i solved with
filtered_data.value['partid'].values[0]
filtered_data.value['partid'].values[0]

Sheet widget - Table with edit mode

I would like the user to be able to see a Table input object, but also to be able to change some of its value (like an Excel Sheet) with the requirements that some cells of the sheet should be locked. My understanding is that we can't do it with the table UI element (there is a onchange method but I am not sure if it is for this purpose?), I found ipyaggrid, itables, and maybe there are some polars widget to do it. Before investigating further, I was wondering if anything was tried and what would be the best practice from a marimo perspective? Thanks...

How do I refresh marimo notebook when modified externally?

Hello people, I learned about Marimo just 1h ago, haven't really read docs yet, so pardon my ignorance My usecase is the following: I have paid subscription to AI provider which has its own extension for VS Code/Rider, other IDEs (in my case it's Cody but it doesn't matter)....
Solution:
and I found solution which works for me good enough so if I put my code into separate python file (module) - it's actually being tracked - so any code modifications of that file are updated automatically so only main notebook file is not being updated...

How do I share marimo notebooks as files properly?

So, my situation is simple: 1. I've created a rye project and added some dependencies 2. I've created a some_notebook.marimo.py with using some of those dependencies I've installed 3. Now I want to share only a notebook, without all those rye complications 4. The person who will download and open my marimo nb should be able to easily install those dependencies...

mo.ui.plotly only updates with new selection

I am using mo.ui.plotly to get a list of selected dots on a map and display the corresponding datapoints in a table below. However, if I make a selection, then double click on the map to clear the selection, the list of dicts returned stays the same (doesn't clear).

centered vs left aligned text

I'm using mo.md to add text to my notebook. Is there a way to control the alignment? It seemed like it was automatically centered earlier, but now it's left aligned.
Solution:
Yea - I think we wrap those in too many elements. You might want to do “<h1 style=“text-align:center”> header… “

difference in execution between publicly shared project link and editor

I am editing a dataframe to replace null values with "unknown" prior to rendering it in a chart with Plotly. When the notebook runs in the online editor, it works as expected. However, if I share the link to the notebook with the project publish button, it seems that the cell rendering the chart somehow runs before the cell that replaces the values.
Solution:
It sounds like the cells that are running out-of-order may not actually be ordered. marimo can't track mutations, so if you are editing a dataframe, you need to either edit it in the same cell in which it's defined, or reassign the dataframe to a new variable in each cell that it is edited. If this is actually the problem, there is an explanation here: https://docs.marimo.io/guides/reactivity.html#avoid-mutating-variables...

Specifying width of notebook in query param

My notebook is best viewed in medium or full width, so I would like to share it with that option pre-selected. Is there a query parameter that allows that?
Solution:
I very carefully changed this setting and hit save a couple times for good measure and the problem went away. Maybe I didn't make sure to hit save after changing it? Either way, it works now. Thank you!

View a local image (png/jpeg)

Is there a simple way to view local images (e.g., JPEG/PNG) in a reactive cell? I found https://docs.marimo.io/guides/integrating_with_marimo/displaying_objects.html, but this seems for remote urls? I guess I could base64 encode the images and create data urls. Just curious if I missed something in the docs.
Solution:
@manzt , you should be able to use mo.image() that supports local paths, remote urls, and bytes

Freeze Column Table Argument Not Working as Expected

I'm trying to use the freeze_columns_left argument in mo.ui.table, and I am not getting an error, but the specified column is not frozen. This is my code. Can you tell me why?
No description

Plotly Scatter Map Not Rendering Correctly

I am attempting to use a Plotly Scatter Map. When I render it, it shows a basic blank chart. I tried to follow the official Plotly tutorial and it does the same thing. I'll put a screenshot below shortly.
Solution:
For reference, this code below does work. I am not sure if marimo needs to provide a default map renderer. ```diff import plotly.express as px ...
No description

Installing specific package versions

It's super cool that I can make a Marimo sandbox and then do import webcolors and get it installed! But how can I import a specific version? E.g., with pip I'd do pip install webcolors==1.12.
Solution:
@Daniel Ashbrook - we just added this https://github.com/marimo-team/marimo/pull/2392 (will be released soon). you can now install a package by version pandas==2.0.0 . if a the package already installed, it will re-install at the requested version. if you are using --sandbox, it will be added with at that version to your inline-script metadata...

Sharing notebooks created under https://marimo.io/dashboard - how does that work?

I mean, other than creating a WASM link and sharing that.
Solution:
notice the share button