Getting Started with Python: Installing uv and Marimo
Contents
- 1 Introduction
- 2 Prerequisites
- 3 Step 1: Understanding the Terminal
- 4 Step 2: Installing uv
- 5 Step 3: Creating Your First Python Project
- 6 Step 4: Installing Marimo
- 7 Step 5: Creating and Running Your First Marimo Notebook
- 8 Step 6: Python Basics for R Users
- 9 Step 7: Stopping and Restarting Marimo
- 10 Outlook
- 11 Further Reading
- 12 References
Introduction[edit]
This guide gets you writing Python code as quickly as possible. If you have used R before, you already understand the logic of working with scripts, running code interactively, and loading libraries. Python works the same way at heart — the tools just have different names.
Instead of installing Python in the traditional way, this guide uses uv, a fast and modern package manager that handles everything for you: it downloads the right Python version, keeps your project's dependencies organized, and makes sure your environment is clean and reproducible. On top of that, you will install marimo, a notebook environment that lets you write and run Python interactively — much like an R Markdown or Quarto notebook, but designed from the ground up for Python.
By the end of this entry, you will have a working Python environment on your computer and your first marimo notebook open and ready to use.
Prerequisites[edit]
Before following this guide, you should:
- Have access to your computer's terminal (macOS) or PowerShell (Windows). If you are unsure how to open it, see the entry Learning to Use Computer's Terminal.
- Have a folder on your computer where you plan to keep your Python projects.
- Be comfortable running commands by typing them and pressing
Enter.
No prior Python knowledge is required. If you have written R code before, that experience will help you recognize patterns as you go.
Step 1: Understanding the Terminal[edit]
Everything in this guide is done through the terminal (macOS/Linux) or PowerShell (Windows). If you are coming from R, think of it as the equivalent of the R console — but instead of running R commands, you are running system commands.
To open the terminal:
- macOS: Press
Command + Space, typeTerminal, and pressEnter. - Windows: Press
Windows + Xand select Windows PowerShell or Terminal.
Once the terminal is open, you will see a blinking cursor. You are ready to type commands.
On macOS, the terminal prompt usually ends with a % or $ symbol. On Windows PowerShell, it ends with >. These symbols are not part of the commands — do not type them. They just indicate that the terminal is waiting for your input.
Step 2: Installing uv[edit]
uv is the tool that will manage your Python installation and all the libraries (called packages) that you use in your projects. Think of it as a combination of R's built-in package installer and a project manager.
Installing uv on macOS[edit]
Open your terminal and run the following command:
curl -LsSf https://astral.sh/uv/install.sh | sh
This downloads and runs the official uv installer. Once it finishes, close and reopen your terminal so the system recognizes the new tool.
Verify the installation:
uv --version
You should see something like:
uv 0.6.12 (or a similar version number)
If you see a version number, uv is installed correctly.
Installing uv on Windows[edit]
Open PowerShell and run:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
After the installation completes, close and reopen PowerShell. Then verify the installation:
uv --version
You should see a version number printed in the terminal, confirming that uv is ready to use.
Tip for R users: Installing uv is roughly equivalent to setting up RStudio for the first time — it is a one-time setup that makes everything else work smoothly afterwards.
Step 3: Creating Your First Python Project[edit]
In Python, it is best practice to work inside a project — a folder that contains your code, a record of which packages you are using, and an isolated Python environment. This is similar to how RStudio projects keep your work organized, but more explicit about dependencies.
Creating a folder for your projects[edit]
First, decide where on your computer you want to keep your Python work. A common choice is a folder called projects inside your home directory.
In the terminal, navigate to your desired location and create a folder:
mkdir projects cd projects
The command mkdir creates a new folder, and cd moves you into it. If you are used to clicking through folders in a file explorer, this is the command-line equivalent.
Initializing a new project[edit]
Now create a new Python project using uv. Replace myproject with any name you like (no spaces):
uv init myproject --python 3.13
This command does several things at once:
- Creates a new folder called
myproject - Downloads and installs Python 3.13 (the version specified) if it is not already on your computer
- Sets up an isolated environment inside the project folder
- Creates a few configuration files that track your project's dependencies
Move into the new project folder:
cd myproject
What is inside the project folder?[edit]
If you look inside the folder (you can use your file explorer or the terminal command ls on macOS / dir on Windows), you will see:
| File or Folder | Purpose |
|---|---|
pyproject.toml
|
Lists your project's dependencies and configuration. Think of it as the Python equivalent of an R renv.lock file.
|
.python-version
|
Records which Python version this project uses. |
.venv/
|
The isolated environment folder. You should never edit this manually. |
hello.py
|
A small example Python file created automatically. |
Do not delete the .venv folder or the pyproject.toml file. They are essential for your project to work correctly. If you accidentally delete them, you can recreate them by running uv sync inside the project folder.
Step 4: Installing Marimo[edit]
marimo is a modern Python notebook environment. If you have used R Markdown or Quarto, you will feel at home: you write code in cells, run them interactively, and see the output immediately. Marimo is designed to be reactive — when you change a variable in one cell, any other cells that depend on it update automatically.
To install marimo inside your current project, run:
uv add "marimo[recommended]"
uv add is the command to add a new package to your project — it is the equivalent of install.packages() in R, but it also records the dependency automatically so that anyone else using your project can install the same packages.
The [recommended] part installs marimo together with a set of useful extras, including support for interactive charts and data tables.
You will see uv download and install marimo and its dependencies. This may take a minute the first time. When it finishes, your terminal prompt will return.
Verifying the installation[edit]
To confirm that marimo was installed correctly, run:
uv run marimo --version
You should see a version number:
0.12.0 (or a similar version)
The command uv run is how you run tools inside your project's environment. Always use uv run instead of running commands directly — this ensures you are using the packages installed in your project, not something else on your computer.
Step 5: Creating and Running Your First Marimo Notebook[edit]
Now you are ready to open marimo and write your first Python code.
Creating a new notebook[edit]
To create and open a new marimo notebook, run:
uv run marimo edit my_first_notebook.py
This command does two things:
- Creates a new file called
my_first_notebook.pyin your project folder (marimo notebooks are plain Python files, not a special format) - Opens the marimo editor in your web browser
Your default browser will open automatically with the marimo interface. You should see a clean notebook with one empty cell ready for input.
If your browser does not open automatically, look at the terminal output. You will see a line like http://localhost:2718. Copy that address and paste it into your browser manually.
[edit]
The marimo interface is a web page that runs locally on your computer. The main area shows your notebook cells. At the top, there is a toolbar with buttons to run cells and configure the notebook. On the left, there is a panel for exploring variables and files.
Key interactions:
- Run a cell: Press
Shift + Enteror click the play button (▶) at the top right of the cell. - Add a new cell below: Click the
+button that appears between cells, or pressCtrl + Enter(Windows) /Cmd + Enter(macOS) after running a cell. - Delete a cell: Click the three-dot menu (⋯) on the right side of the cell and select Delete.
Writing your first Python code[edit]
Click on the empty cell and type the following:
print("Hello from Python!")
Press Shift + Enter to run the cell. You should see the output appear directly below the cell:
Hello from Python!
Congratulations — you have just run your first Python code in a marimo notebook.
Step 6: Python Basics for R Users[edit]
This section shows you the most common Python patterns and how they compare to R. You do not need to memorize these now — use this as a reference as you explore.
Variables[edit]
In R, you assign values using <-. In Python, you use =:
# This is a comment in Python (same as in R) name = "Jorge" age = 35 temperature = 22.5
In a marimo cell, the last expression in a cell is displayed as output automatically. So if you type just age at the end of a cell, marimo will show its value.
Working with numbers[edit]
Arithmetic works the same as in R:
result = (10 + 5) * 2 / 4 result
7.5
Lists (equivalent to R vectors)[edit]
In R, you create a vector with c(). In Python, you use square brackets:
# R equivalent: temperatures <- c(22.1, 23.5, 21.8, 24.0) temperatures = [22.1, 23.5, 21.8, 24.0] temperatures
[22.1, 23.5, 21.8, 24.0]
Important difference from R: In Python, list indexing starts at 0, not 1. So temperatures[0] gives the first element (22.1), and temperatures[3] gives the fourth element (24.0). This is one of the most common sources of confusion for R users.
Importing packages[edit]
In R, you load a package with library(). In Python, you use import:
# R equivalent: library(ggplot2) import matplotlib.pyplot as plt # R equivalent: library(dplyr) import pandas as pd
The as pd part creates a shorthand alias. This is a convention in the Python community — pd for pandas and plt for matplotlib are standard abbreviations you will see everywhere.
Working with data: pandas DataFrames[edit]
If you use data frames in R, you will find pandas familiar. A pandas DataFrame works the same way — rows and columns, with column names.
First, make sure pandas is installed in your project:
uv add pandas
Then, in a marimo cell:
import pandas as pd
# Create a simple DataFrame (R equivalent: data.frame())
data = pd.DataFrame({
"city": ["Berlin", "Paris", "Madrid"],
"temperature": [18.2, 21.5, 26.3],
"humidity": [72, 65, 55]
})
data
city temperature humidity 0 Berlin 18.2 72 1 Paris 21.5 65 2 Madrid 26.3 55
Notice that marimo renders DataFrames as a formatted table automatically — no need to call any special display function.
To read a CSV file (equivalent to R's read.csv()):
import pandas as pd
df = pd.read_csv("mydata.csv")
df.head() # Show the first 5 rows (like head() in R)
Step 7: Stopping and Restarting Marimo[edit]
When you are done working, you can close the browser tab. The marimo server will still be running in the terminal. To stop it completely, go back to your terminal and press Ctrl + C.
The next time you want to open the same notebook, navigate to your project folder in the terminal and run:
uv run marimo edit my_first_notebook.py
Your notebook will open exactly as you left it. All the code is saved in the .py file, so you can also open it in any text editor if you want to inspect or copy the code.
Outlook[edit]
You now have a complete, working Python environment on your computer. You installed uv, created a project with an isolated environment, installed marimo, and ran your first notebook. These are the same tools used by professional Python developers and data scientists — you are starting with the right foundation.
As a next step, try loading a CSV file you already have from your R work, exploring it with pandas, and producing a quick chart with matplotlib or seaborn. The patterns will feel familiar, and the differences from R will become intuitive quickly.
The combination of uv and marimo keeps your workflow clean: uv ensures your environment is always reproducible, and marimo ensures your notebooks are always in a consistent, runnable state. Both tools are actively developed and have excellent documentation. To go deeper on either tool, see the dedicated entries UV as Package Manager and Marimo Notebooks.
Further Reading[edit]
- Learning to Use Computer's Terminal — How to open and navigate the terminal on macOS and Windows.
- UV as Package Manager — Full reference for uv commands, project management, and dependency handling.
- Marimo Notebooks — Deep dive into the marimo notebook environment, including reactive execution, interactive UI elements, and app deployment.
- pandas documentation — Reference for data manipulation with pandas DataFrames.
References[edit]
Astral. 2024. "uv: An Extremely Fast Python Package and Project Manager." Astral documentation. https://docs.astral.sh/uv/.
Marimo Team. 2024. "marimo: A Reactive Python Notebook." marimo documentation. https://docs.marimo.io/
McKinney, Wes. 2022. Python for Data Analysis . 3rd ed. Sebastopol: O'Reilly Media.
Python Software Foundation. 2024. "The Python Tutorial." Python documentation. https://docs.python.org/3/tutorial/.
This entry was partially generated using Claude Cowork. It was guided and revised by J. Gustavo Rodriguez