Installation#

Step 1. Clone GitHub Repository#

Users can clone the repository using HTTPS, SSH, or GitHub CLI. See GitHub docs for information on the different cloning methods. If you run into issues, follow GitHub troubleshooting suggestions here.

Using HTTPS#

$ git clone https://github.com/PyPSA/pypsa-usa.git

Using SSH-Key#

If it your first time cloning a repository through ssh, you will need to set up your git with an ssh-key by following these directions.

$ git clone git@github.com:PyPSA/pypsa-usa.git

Step 2. Initialize Configuration files#

From the command line, run the script init_pypsa_usa.sh to copy configuration file templates into the workflow/config folder.

$ bash init_pypsa_usa.sh

Step 3: Create Conda Environment#

PyPSA-USA uses conda/mamba to manage project dependencies. You can download and install mamba following the instructions. Follow links for mambaforge installation. There are two ways to install mamba, the first (recommended) method will start with a fresh install, meaning if you have previously installed conda environments, you will need to recreate these conda envs. If you already have conda installed and do not wish to install mamba, you can follow the same set of instructions replacing any mamba with conda

Once mamba is installed, use the environment file within your git repository to activate the pypsa-usa conda environment. This step can take ~10-20 minutes. After creating the mamba environment, you will only need to activate it before running the snakemake workflow.

$ mamba env create -f workflow/envs/environment.yaml
$ mamba activate pypsa-usa

You also have the option to use miniconda. Download Miniconda following their instructions.

Step 4: Install a Solver#

PyPSA-USA uses an external solver to solve the optimization problem formulated in the workflow. After you install your solver and confirm it is accessible within your conda environment, update your solving configuration to match your solver of choice. You can download and install several free options here:

and the non-free, commercial software (for some of which free academic licenses are available)

Step 5: Get an EIA API Key#

The pypsa-usa workflow leverages the EIA API in several steps. The default configuration activates dynamic fuel-cost prices, which requires EIA API key. You can quickly get your key by completing this form.

The API key will be emailed to you, and you can copy the key into the config.api.yaml file.