What is Marimo?
Marimo is a modern, reactive Python notebook.
Think of it as Jupyter’s more reproducible, maintainable cousin:
- Cells automatically re-execute if their dependencies change.
- Everything lives in a plain
.py
script — version control friendly. - You run it locally; view it in your browser.
- Easy to share:
.py
→.html
→ send to anyone.
It’s great for:
- Data analysis
- Quick experiments
- Dashboard-like reports
- Reproducible research
Setup & Installation
Create & Run Notebooks
Convert Existing Notes
Markdown in Marimo
Save, Export & Share
File Structure Tips
✅ Step-by-Step: Make your own env the default for Marimo
Activate your environment
For .venv
:
# From your project root
source .venv/bin/activate
For Conda:
conda activate myenv # replace 'myenv' with your env name
Install ipykernel inside your env
This makes your environment show up as a kernel option in Marimo (and Jupyter):
pip install ipykernel
Register your environment as a new kernel
Still inside your activated env, run:
python -m ipykernel install --user --name=.venv --display-name "Python (.venv)"
-name=myenv
: internal name — can be anything, no spaces.-display-name
: friendly name you’ll see in Marimo → use something likePython (myenv)
orPython (.venv)
.
✅ Now your kernel is installed!
Open Marimo and switch the kernel
- Open your
.marimo
notebook. - Go to the Kernel or Interpreter menu (top bar).
- Pick Python (myenv) or whatever display name you chose.
- Restart the kernel if asked.
5️⃣ Confirm it’s using YOUR env
Run this in a cell:
python
CopyEdit
import sys
print(sys.executable)
You should see a path like:
swift
CopyEdit
/path/to/your/project/.venv/bin/python
or
swift
CopyEdit
/Users/you/miniconda3/envs/myenv/bin/python
If you still see something like /usr/bin/python
or /path/to/marimo
, you’re still on the default kernel → switch it again.
6️⃣ (Optional) Disable Conda base
if you use Conda
To avoid base
conflicting with your custom env, run once:
bash
CopyEdit
conda config --set auto_activate_base false
✅ Quick checklist
✔️ Activate env
✔️ Install ipykernel
✔️ Register kernel with python -m ipykernel install
✔️ Switch kernel in Marimo
✔️ Confirm with sys.executable
🔥 Result
Now, all your Marimo notebooks run inside your real environment — no more surprises, no more duplicated installs.
This is the best practice for real projects, version control, and reproducibility.
If you want, I can help you write a small Makefile
or shell alias to automate this setup — just say so!
Ask ChatGPT
✅ 🔑 Marimo Commands Cheat Sheet
Marimo’s CLI is very clean — here are the main commands, when to use them, and extra flags you should know.
🗂️ 1️⃣ marimo run
What it does:
Launches your .py
notebook as a local interactive server in your browser.
Basic use:
bash
CopyEdit
marimo run my_notebook.py
Useful flags:
Flag | Example | What it does |
--port | --port 3000 | Runs the server on a different port if 2718 is busy. |
--host | --host 0.0.0.0 | Makes the notebook accessible on your local network (useful for sharing on LAN). |
--no-browser | --no-browser | Starts the server but does NOT auto-open your browser (sometimes useful in scripts or headless servers). |
✏️ 2️⃣ marimo edit
What it does:
Opens an existing Marimo notebook in your default editor.
Use case:
This just opens the .py
file in whatever editor is set as default for .py
— so honestly, it’s optional. Many people just use VSCode, PyCharm, or vim directly.
Example:
bash
CopyEdit
marimo edit my_notebook.py
📦 3️⃣ marimo export
What it does:
Converts your .py
notebook to a static HTML so you can share it with anyone.
Basic use:
bash
CopyEdit
marimo export my_notebook.py my_notebook.html
Pro tip:
Before exporting, make sure your notebook runs cleanly so that outputs are saved in the HTML.
🚀 4️⃣ marimo new
What it does:
Creates a new starter notebook with example cells.
Example:
bash
CopyEdit
marimo new my_new_notebook.py
Tip:
This adds a few example cells to help you get started. You can delete or modify them.
🧩 5️⃣ marimo --help
What it does:
Shows you all available commands and options in your version.
Example:
bash
CopyEdit
marimo --help
✅ Summary Table: All Marimo CLI Commands
Command | Purpose | Example | Notes |
marimo run | Run an interactive notebook | marimo run my.py | Add --port , --host as needed |
marimo edit | Open notebook in default editor | marimo edit my.py | You can open manually too |
marimo export | Convert .py to static .html | marimo export my.py my.html | Great for sharing |
marimo new | Create a new notebook with example cells | marimo new my.py | Good starter template |
marimo --help | Show help & options | marimo --help | Always works |
✅ Tips for real usage
🔗 Most used:
marimo run
and marimo export
— these 2 cover 90% of your workflow.
⚡ Ports:
If you run multiple notebooks, always specify different ports:
bash
CopyEdit
marimo run notebook1.py --port 2718
marimo run notebook2.py --port 3000
💡 Use your own editor:
marimo edit
is optional — it’s faster to just open .py
files in VSCode, Sublime, or PyCharm.
🌐 Sharing on LAN:
Use --host 0.0.0.0
+ firewall open → share your notebook with others on your Wi-Fi:
bash
CopyEdit
marimo run my.py --host 0.0.0.0 --port 8000
Then visit http://<your-local-ip>:8000
from another device.
✅ Add to your Marimo Guide
🗂️ Core CLI: run, edit, export, new, --help🚀 Always remember:
run
for interactive,export
for static sharing,new
for quick starters.