Get help from the marimo community

So after a lot of messing around I was able to get a notebook to run in VSCode. I have marimo installed via a uv environment.

It took quite a long time to get started and I was just wondering if this is normal behaviour?

I've included a screenshot of the Output in VSCode. It shows that from start to finish it took nearly 3 minutes.
5 comments
M
a
d
I am encountering an issue where if I try to query a MS sql database, it queries and outputs it just fine but the cell itself will run and run long after the query has finished. In my screenshot example I ran timeout to display how long the cell actually took yet the delay persists afterword and I can't do anything else until it's finished.

I can run the same code in a regular python script and it resolves immediately so it just seems to be some weird interaction between sqlalchemy but honestly was unsure whre to even look to troubleshoot this.
22 comments
J
M
R
S
Lately, maybe for the past two weeks or so, I've been getting this message from the Marimo screen. I can sometimes get it to work, but most of the time now it's just this message. Any ideas on how to correct? I was hoping not to open new shell and browser window for every single project so I've been using the parent directory when I open Marimo.
5 comments
M
J
I have a FastAPI app with Marimo app mounted, as in the docs. No other endpoints at the moment. I’m working with a decent amount of data and the notebook uses roughly 1Gb of memory (per stats in edit mode).

I’ve recently deployed it in the production environment, which for now only has a handful of users, and I’m noticing that the memory usage increases very quickly - 6Gb in only 30 minutes and continues going up, never going down, even after users stop using it. Is there potentially a memory leak with the programmatic deployment? (Idk about “edit or pure “run” mode)

From a glance at the SessionManager code, is it possible that sessions are never cleaned up because kernels are not shutdown? Is there a mechanism that shuts down the kernel in run mode, which would then satisfy the condition to clean orphaned sessions?

Also, any performance tips or gotchas for this type of deployment would be very appreciated - for some reason the app runs much slower in the production environment than locally on my machine or in a dev ec2 instance. If there is anything that you feel could be implemented for improvement, I could have a go at it.
2 comments
A

I made a "notebook" where I use a mo.ui.slider which triggers the redraw of a matplotlib plot. But my approach is very naive and the result is ugly:

Python
# first
phi = mo.ui.slider(-10, 10, 0.1, value=-2, label="$\\varphi$")

# then
plt.plot(x_arr, np.sin(x_arr + phi.value))
plt.show()

Before marimo, I used some kind of in-place update routine like :

Python
line.set_ydata(np.sin(x_arr + phi.value))
fig.canvas.draw()

But it requires the figure to be setup beforehand... And I don't know how to do that

I don't know how to smartly update the plot in marimo, without triggering a full draw again. Full draw which causes the plot to flicker, which looks ugly...

Here is the snippet of code I'm talking about if you wanna see by yourself

Python
import marimo

__generated_with = "0.10.13"
app = marimo.App()


@app.cell(hide_code=True)
def _():
    import marimo as mo
    import numpy as np

    import matplotlib.pyplot as plt
    return mo, np, plt


@app.cell
def _(mo, np):
    x_arr = np.linspace(-8, 8, 1024)

    phi = mo.ui.slider(-10, 10, 0.1, value=-2, label="$\\varphi$")
    return phi, x_arr


@app.cell
def _(mo, phi):

    mo.vstack([
        mo.hstack([phi, mo.md(f"{phi.value:0.02f}"),]),
    ])
    return


@app.cell
def _(np, phi, plt, x_arr):
    plt.plot(x_arr, np.sin(x_arr + phi.value))
    plt.grid()
    plt.show()
    return


if __name__ == "__main__":
    app.run()






3 comments
y
I use log messages to indicate where in the process the script is. Today, I've noticed that the more log messages get printed to one cell, the slower Marimo becomes. I don't think this affects when running from command line, but when in edit mode, if I allow all messages to be printed, then the notebook becomes completely unresponsive. Prior to Christmas I don't believe I had this issue and would be able to print all the messages without any issues, but I'm not completely sure about that.
2 comments
M
J
The notebook loads a couple of Pandas dataframes, each with 5-10M rows, filters each them down to 3-5M rows, samples 10% of them, and plots various charts. Unsure whether to allocate more resources, make my notebook more resource efficient, or something else. I can provide the stacktrace if helpful.
2 comments
A
Hi team, thanks for your work on this package. Apologies for the dumb question, I have been using large datasets and used altair for dynamic plotting with slider filters.
Using on jupyter:
alt.data_transformers.enable("vegafusion")
alt.renderers.enable("jupyter", offline=True), this is very fast (less than 1 sec for the update).
I tried to achieve the same filtering using marimo sliders directly on my polars dataframe and then plotting, this works but it is slower as obviously polars needs to do the filtering and run 2 cells (2-5 seconds).
For this use case, the JupyterChart (jupyter renderer) is faster, is there any plan to have it supported in marimo ? (Other renderers being too slow for large datasets)
22 comments
M
A
t
When sharing a presentation or app, it is unclear if the app is still loading, or how much of it is loaded.

This is a problem if you are sharing the app with someone who is unfamiliar with the platform. If it's taking a while, content might appear to simply not exist or be missing.

There's also a bit of a delay upon initial page load of the app and presentation. After the "loading dependencies" spinner, there's a gap between that and the hour glass spinner in the top left.

With presentation mode, it is even more unclear. It only shows slides / circles at the bottom, only for cells that have executed and have content. Someone might flip through all the slides but to realize all of the content is not there.

Ideally, on the app in the presentation, it would show "Still loading all content, please wait to see all components" with a progress bar.
8 comments
M
r
D
We run an internal reporting application that I would like to speed up significantly. The flow of these reports are all pretty simple:

  1. Pull Data
  2. Run a bunch of calculations
  3. Build visualizations
  4. Display
What I think Marimo is probably capable of, but it isn't super clear to me yet? Is doing something like where we cache the report once it has been calculated. And if the same report is calculated again, just pull in the html that was previously cached. If it is the first time, build the full report and cache that html.

Are there any examples around this? What feels weird to me is a notebook caching itself as html programatically and potentially displaying a cached version of itself. But it seems like the tools are probably already in place to do this?
See the attached code. If I assign a large numpy array to a cell-scoped variable, then after the cell is done running the memory is still occupied (about 7.5 GB). If I rename the cell-scoped variable and rerun, then the old memory still remains occupied and a new, large chunk of memory is allocated (so now taking about 15 GB).
4 comments
A
e
Hi, I'd like to try out marimo to compose music, but I can't play midi files. For instance,

Plain Text
mo.audio(src="https://bitmidi.com/uploads/79828.mid")


... will only display a music player with 0:00 / 0:00.
12 comments
M
e
Continuing the conversation with @evandertoorn

Memory Management


How does marimo keep things in memory? marimo internally manages a "globals" dict shared between all cells, everything that is defined is put into this dictionary. The dag primarily works with a static code analysis without respect to what has already been defined etc, to determine the order in which to run cells. Since the global dict is persistent during the session, it could potentially lead to memory build up. However, instead, variables are removed and collected by marimo on cell invalidation.
9 comments
d
e