Reaction Network Structure and Simulation Library for Resilience.
pyRN can be installed from source. After downloading the repository, run the commands from the repository root.
The base installation avoids optional native-heavy dependencies so it can install on Linux, Windows, and macOS more reliably:
python -m pip install --upgrade pip setuptools wheel
python -m pip install .For development, install it in editable mode:
python -m pip install -e .Install optional groups only when you need those features:
# Plotting and interactive network displays
python -m pip install '.[viz]'
# RoadRunner-based simulation features
python -m pip install '.[roadrunner]'
# Geometry/polyhedron features based on pypoman/pycddlib
python -m pip install '.[geometry]'
# Everything optional
python -m pip install '.[all]'If an optional dependency is missing, pyRN raises an error with the extra to install.
The geometry extra installs pypoman, which depends on pycddlib and the native cddlib library. If building pycddlib fails with an error such as ld: library 'cdd' not found, install the system library first.
macOS with Homebrew:
brew install cddlib gmp
export CFLAGS="-I$(brew --prefix cddlib)/include"
export LDFLAGS="-L$(brew --prefix cddlib)/lib"
python -m pip install '.[geometry]'Debian/Ubuntu:
sudo apt-get update
sudo apt-get install build-essential python3-dev libcdd-dev libgmp-dev libglpk-dev
python -m pip install '.[geometry]'Windows:
Python Setup (required for all optional features):
-
Download and install Python from python.org:
- During installation, check both:
- ☑ "Add python.exe to PATH"
- ☑ "Use admin privileges when installing py.exe"
- After installation, click "Disable path length limit" to avoid issues with long file paths
- During installation, check both:
-
Upgrade pip and build tools:
python -m pip install --upgrade pip setuptools wheel
Geometry features (pycddlib):
The recommended approach is using conda or mamba, as prebuilt wheels are available there. If you prefer pure pip, pre-built wheels exist for Python 3.10–3.12 on most systems.
Option A: Using conda/mamba (recommended)
# If you don't have conda, install Miniconda from https://docs.conda.io/projects/miniconda/
conda create -n pyrn_env python=3.11
conda activate pyrn_env
conda install -c conda-forge cddlib gmp
python -m pip install '.[geometry]'Option B: Using pip with wheels (Python 3.10–3.12)
For recent Python versions on Windows, prebuilt wheels of pycddlib are often available. Try installing directly:
python -m pip install '.[geometry]'If wheels are not available for your Python version and compilation fails, refer to Option A.
Optional: GLPK support (if needed for optimization features)
If you need GLPK for linear optimization, you can use the native binary:
-
Download GLPK for Windows from GNU GLPK:
- Download the precompiled Windows binary
- Extract the archive and add the
bindirectory to your PATH:- Open "Environment Variables" (search in Windows Start menu)
- Edit "Path" and add the full path to the GLPK
binfolder
- Verify:
glpsol --versionin a new PowerShell terminal
-
Alternatively, use Python package (simpler):
python -m pip install glpk-py
Python 3.10–3.12 is usually the most stable path for optional native dependencies. Python 3.13 support depends on wheel availability for each dependency.
lxml is part of the base installation. On most platforms pip installs a wheel automatically. If it has to build from source, install the platform XML development libraries first. See the lxml installation documentation.
For more detail, see the Installation notebook.
A descriptive use of each module of the library can be found in the notebook folder.
There is also a Binder link for interactive use of the notebooks:
Each function of the library is documented in the corresponding module under the pyRN directory. Complete documentation will be released in the future.