Tutorials 2–10 use the Demeter land-use / land-cover disaggregation model as their running example. This page is the one-time setup that makes those tutorials' code blocks actually executable on your machine. After completing it you will have:
- The Scalable repo and the Demeter source tree on disk.
- The Demeter Zenodo example dataset under
./demeter_data/. - (Optional) A locally built
demeter:localcontainer image suitable for use as a Dask worker image on Kubernetes / Fargate. - A successful smoke-run of one Demeter scenario through Scalable.
The Demeter source already lives in the Scalable monorepo at
capabilities/demeter — you cloned it when you cloned this repository.
- Python 3.11 or later.
- Git (to verify the Demeter clone).
- (Optional) Docker for the container build / smoke-test.
- ~ 1 GB of free disk space for
demeter_data/.
From the Scalable repository root:
python -m venv .venv
source .venv/bin/activate
# Scalable itself
pip install -e .
# Demeter as an editable install so you can see the source it ships
pip install -e capabilities/demeterBoth installs are lightweight; Demeter's heavy native dependencies
(netcdf4, scipy, matplotlib) come from PyPI wheels.
Demeter ships a Zenodo bundle of GCAM reference scenarios and constraint files. Download it once:
import demeter
demeter.get_package_data("./demeter_data")The directory layout looks like this when complete (Zenodo bundle for Demeter 2.0.x):
demeter_data/
├── config_gcam_reference.ini
└── inputs/
├── allocation/
├── constraints/
├── mapping/
├── observed/
└── projected/
The :download:`canonical workflow </examples/workflow_demeter.py>` resolves
the base .ini automatically; if your bundle expands to a different
path, set the DEMETER_DATA environment variable or pass --data-dir
to scalable_example.run.
Tutorials 5 (cloud), 8 (Kubernetes), and 10 (AI composition) reference a
Demeter container image. The Scalable-friendly Dockerfile lives at
capabilities/demeter/Dockerfile.scalable and uses Python 3.11 +
slim-bookworm:
docker build \
-t demeter:local \
-f capabilities/demeter/Dockerfile.scalable \
capabilities/demeterSkip this step if you only plan to run the local target — the
containers: none mode in
:download:`scalable.demeter.yaml </examples/scalable.demeter.yaml>` does not
need an image.
The capabilities/demeter/scalable_example/ subpackage ships a runnable
driver that exercises the full pipeline. Run a single scenario locally:
python -m scalable_example.run --scenarios referenceExpected output (abbreviated):
2026-05-20 14:03:11 INFO scalable_example.demeter Using shared manifest:
/…/scalable/docs/examples/scalable.demeter.yaml
2026-05-20 14:03:13 INFO scalable_example.demeter Prepared 1 scenario config(s)
2026-05-20 14:04:42 INFO scalable_example.demeter Completed Demeter runs for: reference
{
"summary_path": "/…/outputs/demeter/_summary/scenarios.json",
"scenario_count": 1
}
What just happened?
- Stage 1 (
prepare_demeter_config) cloned the Zenodoconfig.iniinto./outputs/demeter/reference/and rewrote the[PARAMS] scenarioand[STRUCTURE] output_dirfields. - Stage 2 (
run_demeter_scenario) invoked :func:`demeter.run_model` against that.inion a Scalable worker taggeddemeter. - Stage 3 (
aggregate_demeter_outputs) collected the per-scenario summary into_summary/scenarios.json.
Add scenarios to fan out:
python -m scalable_example.run --scenarios reference ssp1 ssp2Each scenario runs in its own Dask process; on a 4-core laptop the
local target processes them in parallel up to max_workers: 4.
The :download:`reference workflow </examples/workflow_demeter.py>` lives at
docs/examples/workflow_demeter.py. It reads the same manifest and
ships the same three task functions but is loaded as a script by the
Scalable CLI:
scalable run docs/examples/scalable.demeter.yaml \
--target local \
--workflow docs/examples/workflow_demeter.pyThis is the form the rest of the tutorials use when they say "run the
Demeter pipeline". The scalable_example driver above is a convenience
wrapper that bypasses the CLI in favor of direct Python; both ultimately
call :class:`scalable.ScalableSession` and produce identical output.
- ``ModuleNotFoundError: No module named 'demeter'``
- The Demeter editable install in step 1 didn't pick up. Re-run
pip install -e capabilities/demeterand ensure the.venvis activated. - ``FileNotFoundError`` for ``config_gcam_reference/config.ini``
- Step 2 (data download) was skipped or wrote to a different directory.
Confirm with
ls demeter_data/example/config_gcam_reference/and re-rundemeter.get_package_data("./demeter_data")if needed. - ``MemoryError`` during ``run_demeter_scenario``
- Default local target allocates 4 GB per worker; the reference scenario
fits, but fine-resolution variants can exceed it. Edit the manifest
target
localto increase per-process memory, or apply thek8s-fine-resolutionoverlay (which setsdemeter.memory: 64G) when running on a larger target. - Docker build fails on ``apt-get install libhdf5-dev``
- The Scalable-friendly Dockerfile assumes the host can reach the Debian
package mirrors. Behind a proxy you may need to pass
--build-arg HTTP_PROXY=.... - Tests fail with ``ImportError: cannot import name 'configobj'``
- The Demeter editable install did not pull its dependencies. Run
pip install -r capabilities/demeter/requirements.txt. - ``ModuleNotFoundError: No module named 'pkg_resources'`` on Python 3.13+
- Setuptools 81+ dropped
pkg_resources; Demeter still imports it. Pin topip install 'setuptools<81'until the upstream Demeter release migrates toimportlib.metadata.
``ValueError: assignment destination is read-only`` inside demeter.demeter_io.reader.read_base
Triggered by a Demeter-internal compatibility issue with numpy 2.x where a returned array carrieswriteable=False. Pin topip install 'numpy<2'or apply the upstream fix from the Demeter issue tracker. The Scalable side of the pipeline is unaffected — the per-scenario.iniwas generated correctly and the task was scheduled on a Scalable worker; the failure is wholly insidedemeter.run_model.
You now have a runnable Demeter pipeline. Continue with:
- :ref:`tutorial_getting_started` — Tutorial 1 verifies the Scalable
install with the trivial
hello-scalableproject. - :ref:`tutorial_manifest_system` — Tutorial 2 dissects
scalable.demeter.yaml. - :ref:`tutorial_scaling_strategies` — Tutorial 3 fans out to N Demeter scenarios.
- :ref:`tutorial_ai_composition` — Tutorial 10 onboards the same Demeter
repo via
scalable init-component.