Get help from the marimo community

I downloaded and installed the Marimo extension in VSCode recently but whenever i try to open the file as VSCode notebook, it indicates Loading...
Server tries to connect with localhost but doesn't.
How can i use it in VSCode?
1 comment
s
I've tried the following code:

Plain Text
ztimesbtn = mo.ui.button(value = False, on_click=lambda value: not value, label="Show answer")

ztimeslst = [mo.md(
    r"""
    Note that $\Bbb Z$ is not a group if we instead take the operation to be multiplication.  

    In this example, we do have a set and operation.  The operation is associative.

    In fact, there is even an identity element!  

    It is 


    """), 
    ztimesbtn]


and then in another cell

Plain Text
if ztimesbtn.value:
    mo.vstack(ztimeslst + [mo.md(r""" 1. """)])
else:
    mo.vstack(ztimeslst)


However, the second cell does not render anything. I tried looking at examples of how to use buttons and such but I don't see anything that would fix this.

It might even be helpful to ask something slightly more general: How do you make a cell "return" an HTML object that the cell then renders? In most cases you just write the object and run the cell, but if the object isn't the final thing that the cell evaluates, is there some other way?
1 comment
S
Hi everyone, I've pushed a question on the Github regarding the handling of state between multiple data editors. I know there are some experts around, so don't hesitate to check it out if you're looking for a challenge 💪

Thanks 🙏
1 comment
S
U
Umar
·
U
Solved

Import Error

from langgraph.graph import StateGraph, START, END

This cell raised an exception: ModuleNotFoundError('No module named 'langgraph.graph'; 'langgraph' is not a package')

Why its looking for langgraph.graph whereas langgraph is already installed.
3 comments
C
M
U
I'm trying to render a thing like this:

Plain Text
mo.md(
    r"""
    Just as with propositions:
    """ 
)

mo.callout(mo.md(r"""
    Two sentences, $\alpha$ and $\beta$, are **equivalent** 
    """))


where each one returns some kind of markdown object, inside a single cell. Essentially, I want a single cell to have some text in a callout and some not in it.

It's not a big deal if I have to split up the cells but just wondering if this kind of thing is possible.
2 comments
M
d
I am deploying to gihub pages and I include an image using the github template. That is I use Image.open(mo.notebook_location() / 'public' / 'pend.png').

This works when I edit the notebook (the picture is loaded), but it does not work when I build the site (neither on github nor locally by running python scripts/build.py). The rest of the notebook works as I expected.
9 comments
M
k
Hello,

when I run marimo edit file.py, I get

[W 250314 10:58:29 manager:177] Failed to read script config: 'charmap' codec can't decode byte 0x8d in position 887: character maps to <undefined>

If I run marimo edit --sandbox file.py, it does not even run due to the error.

I get the issue (I think), but I am unable to decode where it happens.
9 comments
S
k
M
H
I'm using Marimo as an API playground. It works very well, Marimo seems very suitable. Can I make it simpler? Now each HTTP request requires two cells - one for request, another for response - and a tuple of some_endpoint, some_endpoint_button. Is it possible to implement it in one cell and/or avoid exposing button variable?

Bonus question: how do I implement a "copy as curl" button? I can't find functionality to deal with system clipbard.

Plain Text
@app.cell
def _(config, private):
    admin_projects, admin_projects_button = private.request('GET', f'/admin/user/{config.user_id}/projects')
    admin_projects
    return admin_projects, admin_projects_button


@app.cell
def _(admin_projects, admin_projects_button):
    admin_projects.run(admin_projects_button)
    return


In this example private.request() returns (Request, mo.ui.run_button) tuple:

Plain Text
def request(self, method, url, *, json = None):
    return (
        Request(
            method,
            f'{self.base_url}{url}',
            json=json,
            auth=self.auth,
            timeout=self.timeout,
            client=self,
        ),
        mo.ui.run_button(label='send'),
    )


And Request.run() uses mo.stop and mo.status.spinner:

Plain Text
def run(self, button):
    mo.stop(not button.value, mo.md('press *send* ☝️'))
    with mo.status.spinner(subtitle='Loading...') as _spinner:
        response = self.send()
    return response
1 comment
M
Sometimes, I see an error like this. I don't know how to reproduce it, nor do I know what it means. Maybe knowing what the error is, I can find a way to reproduce it in my code, but for now I need your help trying to figure it out.
When I try to start by running marimo edit

this is the error that appear.
Plain Text
  File "/Users/mh/.pyenv/versions/3.10.10/lib/python3.10/site-packages/marimo/_server/utils.py", line 59, in find_free_port
    return find_free_port(next_port, attempts - 1)
  File "/Users/mh/.pyenv/versions/3.10.10/lib/python3.10/site-packages/marimo/_server/utils.py", line 59, in find_free_port
    return find_free_port(next_port, attempts - 1)
  File "/Users/mh/.pyenv/versions/3.10.10/lib/python3.10/site-packages/marimo/_server/utils.py", line 59, in find_free_port
    return find_free_port(next_port, attempts - 1)
  [Previous line repeated 97 more times]
  File "/Users/mh/.pyenv/versions/3.10.10/lib/python3.10/site-packages/marimo/_server/utils.py", line 43, in find_free_port
    raise RuntimeError("Could not find a free port")
RuntimeError: Could not find a free port


I have check my ports if marimo is running on any ports using sudo lsof -i -P | grep LISTEN, but theres none.
1 comment
M

I'm looking for a way, any way, to highlight text in markdown in marimo, be able to right click or press a button, and add a comment to the highlighted text.
Is this possible in marimo?

Plain Text
@app.cell
def input_cell(mo):
    my_input = mo.ui.text()
    my_input
    return (my_input,)


@app.cell
def result_cell(my_input):
    my_input.value
    return


If I run input_cell, the result_cell will immediately be run after that (because my_input.value). I know that we can change the default value or use callback functions, but it could be a good idea to prevent dependent cells do not run and wait for the users actual input.
7 comments
M
H
Hello! My organization uses an internal network for some of our business processes, and many pages are secured with SSL/TLS certificates! We have an openAI compatible API that I’m trying to configure, however it requires a specific Certificate Authority bundle to verify the connection.

I wasn’t sure if it would be difficult to add in support for additional arguments/config keywords that get passed to the connection client, including custom CA bundles, ssl_verify arguments, etc.


As is right now, i think Marimo uses the OpenAI python package which itself uses httpx under the hood to build the connection. Httpx does support a specific argument for a ca bundle! As is, without being able to specify that bundle I get an error:

httpcore.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed, unable to get local issuer certificate. (_ssl.c:1007)

My proposed solution would be allowing additional arguments in the config toml for ssl_verify and caBundlePath which would be passed to the appropriate OpenAI client creation segment in the code.
16 comments
R
M
k
If I paste a large chunk of code into the scratchpad the main notebook area scrolls which is annoying..
I'm on a WSL + NixOS setup and recently switched to Wayland, so my xdg settings are all messed up and running marimo edit freezes everything up. I've tried most of the low hanging fruit but can't figure out why the output of my marimo env command leaves "browser" blank. It doesn't do this on the windows side, and I can run marimo fine. Any ideas??
18 comments
s
d
Hi team,

I don't really need help here, because I ended up using httpx and that was sufficient for my issue, but while the chat component works fine, I can't seem to be able to make the openai chatcompletions work at all. And because we can't direct it to use the openai package directly because we have specific types, I decided not to work on a solution myself... so just reporting.

Tried sandbox, 3.13, 3.12, 3.11, not a python issue. Forced reinstall, upgrade etc also nothing.

hwo to fix this?
Running openai.py ⚡

➜ URL: http://localhost:2719

[W 250311 00:39:19 file_watcher:26] watchdog is not installed, using polling file watcher
Traceback (most recent call last):
File "/Users/arthrod/.local/share/uv/python/cpython-3.12.7-macos-aarch64-none/lib/python3.12/site-packages/marimo/_runtime/executor.py", line 141, in execute_cell
exec(cell.body, glbls)
File "/Users/arthrod/tmp/marimo_28512/marimocellZBYS.py", line 1, in <module>
from openai import OpenAI
File "/Users/arthrod/.local/share/uv/python/cpython-3.12.7-macos-aarch64-none/lib/python3.12/site-packages/marimo/_output/formatters/formatters.py", line 167, in exec_module
factory.register()
File "/Users/arthrod/.local/share/uv/python/cpython-3.12.7-macos-aarch64-none/lib/python3.12/site-packages/marimo/_output/formatters/ai_formatters.py", line 49, in register
from openai.types.chat import ChatCompletion, ChatCompletionChunk
ModuleNotFoundError: No module named 'openai.types'; 'openai' is not a package
[E 250311 00:39:20 ops:302] (error_id=170b3844-933a-43a4-b935-76f716f62ef3) This cell raised an exception: ModuleNotFoundError('No module named 'openai.types'; 'openai' is not a package')
[E 250311 00:39:20 ops:302] (error_id=23237b61-afea-4948-918e-260549b23e4f) An ancestor raised an exception (ModuleNotFoundError):
[E 250311 00:39:20 ops:302] (error_id=0282ed22-40d1-46be-bd46-03d4eb949875) An ancestor raised an exception (ModuleNotFoundError):
10 comments
a
M
Hey, I'm using mo.ui.radio for filtering a dataset as part of a larger ML model evaluation UI. I find that when I have a lot options using the inline option just makes a really wide element for the radio component.

It'd be a nice feature to have ncols, nrows or columns for the UI element to define a little radio grid or similar arguments
1 comment
M
Hello everyone, I'm testing out the experimental data editor function and would like to set a configuration of type "dropdown" for one of the columns of the data editor (in a similar fashion to what is done in Streamlit). Does anyone have a tip on how to do that ? If not possible with the experimental data editor in marimo, are there other jupyter widget which could be used and are compatible with marimo ?

Thanks for the help 🙏
2 comments
l
A
Plain Text
class Test():
   def __init__(self):
        self.a = 1
        self.b = 2 

import inspect

inspect.getsource(Test)


Traceback (most recent call last):
File "/Users/habib/.cache/uv/archive-v0/orE7lLvC9gKEvqF8RJqEB/lib/python3.12/site-packages/marimo/_runtime/executor.py", line 142, in execute_cell
return eval(cell.last_expr, glbls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/folders/q1/7g9hgvc17m95t7yrvcclc75h0000gn/T/marimo_99501/marimocellZzoV.py", line 1, in <module>
inspect.getsource(Test)
File "/Users/habib/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/inspect.py", line 1285, in getsource
lines, lnum = getsourcelines(object)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/habib/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/inspect.py", line 1267, in getsourcelines
lines, lnum = findsource(object)
^^^^^^^^^^^^^^^^^^
File "/Users/habib/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/inspect.py", line 1112, in findsource
raise OSError('could not find class definition')
OSError: could not find class definition
3 comments
C
H
Can python turtles be used with marimo?
1 comment
M
hey guys, I am not a css/frontend guy in any way. I was trying to get a panel with a main callout on the left and a right panel with scrollable callouts. I would like the right callouts to be closer to each other and the left one to take more space on the left.

Also is it possible to make the right ones scrollable while the left one stays in place?

Attached a picture of what I've tried + code

Plain Text
mo.hstack([
    mo.callout("Main"),
    mo.vstack([mo.callout("comments") for _ in range(3)], 
              gap = 0.1, 
              align = "stretch",
              justify = "space-between")
], widths=[0.4, 0.6], align = "stretch")
3 comments
l
V
Have there been any discussions on adding non-python runtimes? i.e. R is the one I had in mind. I know pyodide is specifically python which would make this quite hard, but just wanted to ask whether there had been any discussion around this already
2 comments
l
Hi, when I use marimo without the sandbox feature I often end up installing packages via the integrated package manager - I use uv. If i were to install packages directly from the terminal using uv they would be added to pyproject.toml, it would be great to have packages added to the dependencies in pyproject toml when such file is available and if not running in a sandbox
3 comments
M
l
I thought asking this here before opening an issue on github.

Consider this notebook with these cells.
(it is a versy small simplified version of hg agents course)

I have attached the screenshot of dependencis,

  1. Cell-1 should be run before cell-2. but as in this there are no explicit dependency between them and the cell-2 is getting the env variables underhood we can not guarantee this execution order.
easy solution to solve this problem is mergin cell-1 and cell-2, but for the next problem we can not do that.

  1. Cell-2 should run before cell-5 and cell-4
to be able to monitor the agent. Again this order is not guaranteed.
One dirty solution would be to define a variable in Cell-2 and reference it in Cell-5 and Cell-4.

Does Marimo provides a proper solution for this promblem?
8 comments
A
H
e