Setup

Author

Sadamori Kojaku

Published

September 3, 2025

1 Python and Virtual Environments

We’ll use Python to work with data throughout this course. Python is an excellent choice for network science for its rich ecosystem of libraries, readable and intuitive syntax, and well-documented documentation.

We strongly recommend using virtual environments to manage your Python packages. Virtual environments create isolated Python installations for each project, avoiding dependency hell and providing several key benefits:

Don’t confuse Python virtual environments with virtual machines (VMs). Python virtual environments are lightweight isolation tools that only separate Python packages and dependencies within the same operating system. Virtual machines, on the other hand, create complete isolated operating systems.

  • Reproducibility: Your code will work consistently across different machines and over time
  • Flexibility: You can use different versions of packages for different projects without conflicts
  • Prevent project interference: Changes to one project won’t break another project’s dependencies
Figure 1: Without virtual environments, you risk dependency hell where package conflicts make your projects unusable.

We recommend using mamba and uv. Mamba is a tool for quickly installing Python and other packages, and for creating isolated environments for your projects. uv is a fast Python package and project manager. While we won’t be running uv commands directly in this course, you’ll need uv to properly run Marimo notebooks, which provides a much better development experience. See here for installation instructions.

Follow the following steps to install mamba, uv, along with the minimum Python packages required for this course.

  1. Install mamba
  2. Run the following command to create a new environment with the minimum Python packages required for this course.
mamba create -n advnetsci python==3.11 matplotlib scipy numpy pandas seaborn uv
  1. Activate the environment.
mamba activate advnetsci
  1. Pip install marimo.
pip install marimo

Other Options

If you prefer tools other than uv, here are some alternatives:

  • venv: The standard library for creating virtual environments;
  • pyenv: Great for managing multiple Python versions;
  • Conda: Popular in data science, includes non-Python packages;
  • Mamba: Faster drop-in replacement for conda;
  • Miniforge: Community-driven conda distribution with mamba included;

2 Marimo Notebook

We’ll use Marimo (GitHub) notebooks for assignments and interactive exercises throughout the course. Marimo is a reactive Python notebook that automatically updates when you change code, making it perfect for exploring network data and seeing results in real-time.

Marimo integrates especially tightly with uv and provides a package sandbox feature that lets you inline dependencies directly in notebook files. This is the easiest way to get started - no prior uv knowledge required.

Creating a sandboxed notebook:

uvx marimo edit --sandbox my_notebook.py

This command installs marimo in a temporary environment, tracks your dependencies and stores them in the notebook file, and automatically downloads any existing dependencies.

Running sandboxed notebooks:

uv run my_notebook.py

Benefits: Dependencies are embedded in the notebook file itself, perfect reproducibility, and no need to manage separate dependency files.

Alternative Installation

If you’re not using uv, you can install marimo with pip:

pip install marimo

Running Marimo

To start a new marimo notebook:

marimo edit

To open an existing marimo notebook:

marimo edit notebook.py

3 Github and GitHub Copilot

We’ll use GitHub for assignment collection and auto-grading in this course.

Minimum Requirements

At the minimum level, you only need to:

  1. Create a GitHub account at github.com
  2. Know how to upload files to GitHub

Detailed instructions on how to upload your assignments to GitHub will be provided separately - advanced Git features are not required for the course. See this assignment example to get familiar with the format.

Subscribing to GitHub Copilot

We strongly encourage you to use GitHub Copilot, an AI-powered coding assistant that helps you write code faster and more efficiently. GitHub Copilot is an AI pair programmer that provides intelligent code suggestions, completions, and explanations directly in code editor, including VS Code and Marimo.

Students can get free access to GitHub Copilot Pro, which includes enhanced features and priority access. Visit the GitHub Copilot Pro free access page to get started.

Marimo notebook supports GitHub Copilot out of the box. See the instruction to enable it. If you are using VS Code, you can also install the GitHub Copilot extension to get the same experience.

For Students Interested in Learning More

Understanding Git and GitHub is useful for seamlessly working with assignments and will benefit your programming workflow. Additionally, Git and GitHub integrate nicely with AI tools for productivity improvement, making your development process more efficient.

Git(Hub) and AI tools are like a pair of best friends. Git ensures that all edits are tracked and can be reverted. GitHub makes it easy for you to collaborate with (multiple) AI agents with you.

Understanding Git and Version Control

Git is a version control system that tracks changes in your code over time. Think of it as a sophisticated “save” system that:

  • Keeps a complete history of all changes to your files
  • Lets you go back to any previous version
  • Allows multiple people to work on the same project simultaneously
  • Helps you manage different versions or “branches” of your work

GitHub is a cloud-based platform that hosts Git repositories and adds collaboration features.

Learning Resources

Essential resources to understand Git concepts: