Get help from the marimo community

When running a marimo notebook locally on my laptop copilot works as it should, but when I use the Visual Studio Code port forwarding feature and I connect to the same marimo notebook using the forwarded address, copilot stops working and I get a websockets.exceptions.InvalidURI: http://localhost:2918/copilot isn't a valid URI: scheme isn't ws or wss.
Any idea why this is happening? And how can this be fixed?
Hi everyone,
Here’s what I want to do:
I have a list a = []
I also have b = mo.ui.text().
I want a to keep appending b.value every time I enter new text into b.
The only working solution I’ve found so far is using mo.state().
I’m wondering if anyone has a better solution that doesn’t require mo.state().

Thank you! 🙏
1 comment
S
I am trying to serve marimo apps on a company server (python, not webassembly).
I have fastapi working fine, but I am running up against a problem with imports.

Originally I thought the sandbox imports would work, but it looks like this is not the case (I found a message on this discord).

That leaves a few options to solve the import problem:

  • use mo.install() to somehow pull in the sandbox imports? But if all the apps are in the same marimo process does this create conflicting imports? Also how would I read in the imports?
  • use marimo run --sandbox and have each app have its own process and port that i have to forward to
  • use a global uv environment for all apps and keep it synced across apps somehow. This will eventually lead to conflicts.
Obviously my preference would be something where i can just have one marimo fastapi app,
but I am not sure what the best way to achieve this is, while keeping apps sandboxed.
Generally each app will have many imports.

Thanks for any advice!
4 comments
M
b
How come some cells have a fullscreen button on the top lefthand side, but some don't? Is it generated based off a heuristic or something?
2 comments
t
M
For example, given
Plain Text
src/my_proj/processors/simple_processor.py
notebooks/nb1.py

I'd like to set the project root as src/proj and, from notebook nb1.py, import
Plain Text
from processors.simple_processor import SimpleProcessor
1 comment
M
Is there a way to let two elements align in a way that jusfies both left and right hand side of the composite component? Currently, I get something like this. But I would like to extend the elements sides so they match:
3 comments
H
M
j
Hello,

I have been trying Marimo over the weekend and I find it great.
All the problems bothering me in Jupyter Notes and some I didn't even realize I had seem to be addressed in Marimo.

There is one thing I cannot seem to figure out:

If I create a plot (the most basic plot) using matplotlib it shows correctly as long as I'm in edit mode but as soon as
I switch to View mode, or slide mode, or I run marimo run my_notebook.py the matlib plots are not shown anymore.

I have also tried with plotly and I get the same problem, the plots are only visible when the notebook is in edit mode.

altair plots seem to be fine though ( they are also visible when I switch to view mode).

I thought this might be a limitation but then I saw examples where matplotlib is being used and the plots are successfully displayed,
like the example: Neural Networks with Micrograd
https://marimo.io/p/@marimo/micrograd

I've seen that the exmaple uses WASM and tried to generate a WASM application from my notebook using:
Plain Text
marimo export html-wasm notebook.py -o notebook.wasm.html

and then serving the generated html.

This did not seem to make any difference, the matplotlib plots still do not show.

Am I missing something ?

Thank you in advance for any answers or suggestions.
7 comments
H
R
I have been using an online tool called Desmos to investigate various mathemetical equations in the last year. This has been very useful but runs into some issues when examining computationally heavy expressions (e.g integrals, etc).

For that reason, I wanted to look into more performant options, and Marimo seemed like an interesting option to play with this idea. I was wondering, though, if anyone would know whether achieving a smoothly varying plot is feasible in Marimo?

Here is an example of a smoothly varying plot: https://www.desmos.com/calculator/4dkhcbjost

My hope is that I can use Sympy along with Marimo to achieve this, but I am still ramping up on Marimo basics before I try it, so figured I'd ask in the meantime.

Thanks!
3 comments
G
O
I did following

  • uv init
  • uv venv
  • source .venv/bin/activate
  • uv add marimo (same problem if using ipykernel or jupyterlab)
  • Open marimo and getting this error:
ImportError: Cannot import 'TreeArgumentsWrapper' from 'jedi.inference.arguments' due to circular import.

marimo and jupyterlab works fine when installed and using with pip.
Hello there! Super glad to use this underrated feature (much easier to get started than jupyter!). I have this situation, where the plot is a bit small, even in fullscreen. How can I make that bigger?
3 comments
M
l
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
I have a altair.Chart() which outputs fine if I render it directly but if I wrap it in a mo.ui.altair_chart() then the string x-axis values which are versions of the form "x.y.x" are getting evaluated as datetimes so the graph is exactly the same except the x-values are erroneously shown as datetimes. How can I stop this? See https://imgur.com/a/0wFfaYk. First graph is raw altair graph, second is wrapped graph.
8 comments
b
M
was wondering what would it be the ideal way to use uv with marimo
should i first create a uv venv & inside create project then inside install marimo or
should i just create a uv project & inside install marimo
cant connect copilot on marimo notebooks
~ Ash Blanc
4 comments
H
Its just saying 'unable to connect'
5 comments
A
A
H
I'm trying to update the options in a multiselect, but it's not working, and I'm not sure if what I'm doing is incorrect, or if marimo just doesnt work the same way as my brain. I've got a dataframe and im making two multiselects based on the values in the dataframe. if the user chooses a value from the first multiselect, i want to filter the options in the second with the values based on the selected option. my callback that I wrote for the first multiselect to update the options in the second is properly filtering the dataframe and finding the new values, but the second multiselect always shows all the possible options.

I've tried all sorts of things to get it to work, including moving stuff to other cells, but that kept causing cyclical dependency errors. In the end I'm wanting to make a few different multiselects and then do other stuff with the filtered dataframe.

I was hoping someone around here would be able to provide some insight. thanks!

here's my non working code 😦
Plain Text
import marimo as mo
import polars as pl
main_df = pl.DataFrame(
    {
        "player":["John", "Tom", "Jerry", "Bob"],
        "team":["Spades", "Spades", "Hearts", "Hearts"],
    }
)

def filter_main_df():
    exprs = []
    if player_select.value:
        exprs.append((pl.col("player").is_in(player_select.value)))
    if team_select.value:
        exprs.append((pl.col("team").is_in(team_select.value)))

    if len(exprs)>0:
        return main_df.filter(
            exprs
        )
    return main_df


def on_player_change(_):
    filtered_df = filter_main_df()
    options = filtered_df["team"].unique().to_list()
    print(f"updating team options to: {options}")
    team_select.options = options


player_select = mo.ui.multiselect.from_series(main_df["player"], on_change=on_player_change)
team_select = mo.ui.multiselect.from_series(main_df["team"])
mo.vstack([player_select, team_select])
3 comments
A
Hi there, i'm a current Jupyter user and am trying out Marimo for the first time.

I have used the converter command to convert my Jupyter notebook to Marimo.
Currently, i'm facing an issue where i cannot load my hydra config in the Marimo notebook.

I have ran marimo edit --headless --host 0.0.0.0 --port 8883 in my root dir (/~/project), which is where marimo_notebook.py resides.

project
|- config
|- hydra
|- config.yaml
|- marimo_notebook.py

However, when i run the following to initialize my hydra config:
Plain Text
with hydra.initialize(config_path='./config/hydra'):
    config_1 = hydra.compose(config_name='config')

I get the error below:
Plain Text
Traceback:
...
    self._missing_config_error(
  File "/opt/conda/lib/python3.10/site-packages/hydra/_internal/config_loader_impl.py", line 102, in _missing_config_error
    raise MissingConfigException(
hydra.errors.MissingConfigException: Primary config directory not found.
Check that the config directory '/tmp/marimo_5081/config/hydra' exists and readable


Why is the root dir: /tmp/marimo_5081/ instead of project?
6 comments
u
A
I would like to inlcude a feature in my notebook where a user imports a csv and it turns into a dataframe. I'm using mo.ui.file_browser. Is there a way to extract the filepath from FileInfo?
1 comment
S
Hello,
I was planning to use the newest testing feature for my notebook, but unfortunately i'm facing an error when trying to run cells from another notebook dedicated to testing.
Using the Cell.run() function throws a TypeError This cell raised an exception: TypeError('unhashable type: 'DataFrame' / 'dict') when using a pandas DataFrame or a dictionary as one of the kwargs.
I am using the latest version. Thanks in advance!
4 comments
A
B
dataframe column value contains hyphen and number suffix
value of n-a gets correct nominal type
value of n-0 gets incorrect temporal type
2 comments
S
l
Hello, I've just discovered the experimental data editor function. I'm wondering if it's possible to have a data frame that contains a column with editable cells and another column that updates automatically according to these values (this column may or may not be editable)? df.value only displays the values but doesn't allow you to edit the cells.
2 comments
M
I am trying to make it so I can export a report I built in Marimo to static HTML so that the report is pre-computed and can be displayed on a separate Marimo application. Part of this report goes into a deep dive analysis of specific variables. Currently the report runs on the app so its easy enough to use the dropdown to choose which variable to dive into.

The report however, is very compute intensive, and it would be nice to run the report beforehand and just show the HTML from it in the app. However, in static HTML, the dropdown doesn't work due to it requiring some python code to run. I am trying to find an adequate workaround for this. I attempted to use tabs, which actually worked magnificently, except for I have too many tabs to fit on the screen. The carousel also almost works, however it is not user friendly to have to scroll down in the carousel to see the full deep dive.

I havent messed too much with WASM stuff. Not sure if you can run the WASM html inside another Marimo app? My hope is that the main Marimo app just shows a list of reports that have been generated and can load the selected HTML report. So I am not sure if that is possible with the WASM export. Something that looks like the dropdown but acts like the tabs would be ideal at this point. I know I could generate a large accordion if needed as well, I just don't love the way it looks as much as something like the tabs. But thought I would check and see if there was a more elegant solution to this?

Thanks!
8 comments
M
n
I found my code would not generate any plots after upgrading and gave this error:

''scatter' object has no attribue '_render_model'

This was the case for even the basic example from the reference docs:

https://hvplot.holoviz.org/reference/tabular/scatter.html
Plain Text
import hvplot.pandas  

from bokeh.sampledata.iris import flowers as df

df.sample(n=5)

df.hvplot.scatter(x='sepal_length', y='sepal_width', by='species', legend='top', height=400, width=400)


Downgrading to 0.10.5 resolves this for me.
1 comment
M
Is there a way to format tables so that the width of different columns can be adjusted?
7 comments
M
j
To write maths and science more easily, I use some common latex packages, like amsmath, mhchem, siunitx...

These packages have a mathjax version or equivalent.
In jupyter I can require those in mardown cells or use a custom.js.

I must be blind but I couldn't find docs on how to do that with marimo.
6 comments
M
L