Skip to content

Civ Sim

James Isnor edited this page Jun 24, 2026 · 1 revision

Colab

This wiki contains how-to instructions for running civilization sim.

As a Jupyter Notebook

The easiest way to run civ_sim is by using the .ipynb notebook. The notebook can be run on any jupyter server, with IDE extensions (e.g. VS Code), or if you have a Google account and want to keep the data from a simulation, Google Colab (linked above) allows you to run the notebook on their hardware without downloading or running anything on your own machine.

Running Locally

civ_sim can be also be downloaded and run locally as a CLI or as a webapp.

# clone the repo
git clone git@github.com:Isnor/civilization_sim.git
cd civilization_sim

# Create a virtual environment (Python 3.12+ required)
python3 -m venv .venv
source .venv/bin/activate

# Install dependencies
pip install .

Solara

Experiments can be configured and run via a UI packaged as a webapp using solara.

solara run app.py

Will start a local webserver and open a browser pointing at the app. See the solara page for more on using the web app.

CLI

Experiments can also be defined as YAML files, run with the CLI, and CSV output written to ./output e.g.:

python main.py --seed 42 --config config/experiment1.yaml --write-output --output ./output/experiment1/

As a library

civ_sim can be installed with pip if you're interested in building something with it, but this is not recommended due to the instability, lack of testing, and lack of proper package distribution:

pip install git+https://github.com/Isnor/civilization_sim.git
from civ_sim.simulation.scenario import CivilizationScenario
from civ_sim.simulation.model import CivilizationModel

config = CivilizationScenario() # add overrides as kwargs here
model = CivilizationModel(scenario=config)

Clone this wiki locally