Skip to content

Quick Start

System requirements

With the low-resolution settings, PyPSA-China-PIK will run on a local machine or laptop. Solving a full year at hourly resolution will require a high performance cluster or server with around 50GB of RAM - depending on your settings.

Installation

  1. Install the conda package manager

    It may be possible to run the workflow with a better manager such as uv but it will not work out of the box

    Conda tips

    Conda is a rather large install with a GUI and features not required by PyPSA-China. You may prefer to use the lighter miniconda, which is our recommendation.

    You can check whether you already have conda with which anaconda or which conda. Newer condas have a faster dependcy solver - as the package is rather large we strongly recommend you update to v> 2024.10.

    Conda tips

    Conda is a rather large install with a GUI and features not required by PyPSA-China. You may prefer to use the lighter miniconda, which is our recommendation

    You can check whether you already have conda with where anaconda or where conda. Newer condas have a faster dependcy solver - as the package is rather large we strongly recommend you update to v> 2024.9.

  2. Setup the environment: This can take a long time

    install dependencies
    cd <workflow_location>
    conda env create --file=workflow/envs/environment.yaml
    
  3. Activate environment

    activate environment
    source activate pypsa-china
    
    activate environment
    conda activate pypsa-china
    
  4. Fetch data

    Commands

    cd my_repository_clone
    conda activate pypsa-china
    snakemake --configfile examples/fetch_data.yaml
    

    if running locally you may need to add --cores 1

    Sources

    Manually fetch the data (faster but requires copy-pasting): https://zenodo.org/records/16810831

    Destinations are in resources/data folders (rasters, cutouts, existing infrastructure).

    A back-up data source is the PyPSA-China paper https://zenodo.org/records/13987282

  5. Install a Solver: e.g. gurobi HiGHS or cplex. The current default configuration uses gurobi.

  6. Run locally

Testing the installation

Test install
source activate pypsa-china
cd <workflow_location>
pytest tests/integration
Test install
conda activate pypsa-china
cd <workflow_location>
pytest tests/integration