A standalone desktop application for NONMEM pharmacometric modelling workflows
NMGUI2 is a PyQt6 desktop application that brings together everything a pharmacometrician needs in one window: browse and compare NONMEM models, evaluate goodness-of-fit, run PsN tools, read .lst output, and visualise model lineage — without switching between terminals, text editors and R.
It runs entirely offline on macOS, Windows and Linux. No browser. No server. No internet connection required during use.
- Features
- Dependencies overview
- Installation — macOS
- Installation — Windows
- Installation — Linux
- First use
- Keyboard shortcuts
- Configuration files
- Contributing
- Author
- Acknowledgements
- License
- Scans a directory for
.modfiles and displays all models in a sortable table - Columns: OFV, ΔOFV (relative to best or user-selected reference), minimisation status, covariance step, condition number, estimation method, individuals, observations, parameters, AIC, runtime
- Colour-coded: green = successful, red = failed/terminated, orange = boundary/stale
- Right-click context menu on any model: toggle star, duplicate, set reference model, compare with another model, view
.lst, show NM-TRAN messages - Keyboard navigation: ↑↓ move rows, Space toggles star, Enter jumps to Output
Parameters — full THETA/OMEGA/SIGMA table with names, estimates, SE, RSE%, 95% CI, SD. Handles BLOCK(n) SAME designs correctly. Export to CSV and HTML report.
Editor — syntax-highlighted .mod editor with save.
Run — launch any PsN tool with live console output and stop button.
Info — comment, status tag (base/candidate/final), notes — all persisted.
Output — structured HTML rendering of the .lst file in-app: summary card, NM-TRAN warnings, convergence table, parameters, ETABAR/shrinkage, correlation and covariance matrices, eigenvalues and condition number. "Open in browser" exports full HTML.
Interactive node graph of model lineage based on ";; 1. Based on:" PsN metadata. Zoom, pan, double-click to select a model.
GOF 2×2, CWRES histogram, QQ plot with Shapiro-Wilk, ETA vs covariate, individual fits, OFV waterfall, convergence traces, and a reactive data explorer with multi-filter scatter plots.
Generate VPCs via vpc, xpose or xpose4 R backends. Editable R script, PNG/PDF export.
Full history of PsN runs with status, duration, and command preview.
Dark/light theme, path configuration, bookmarks — all persisted between sessions.
| Dependency | Minimum version | Purpose |
|---|---|---|
| Python | 3.10 | Runtime |
| PyQt6 | 6.4 | GUI framework |
| pyqtgraph | 0.13 | Interactive plots |
| numpy | 1.24 | Numerical operations |
| matplotlib | 3.7 | CWRES histogram, QQ plot |
| Dependency | Minimum version | Notes |
|---|---|---|
| NONMEM | 7.4 | Must be installed and licensed |
| PsN (Perl-speaks-NONMEM) | 5.6 | Must be on system PATH |
| Perl | 5.16 | Required by PsN |
| Dependency | Notes |
|---|---|
| R ≥ 4.0 | Must be on system PATH (Rscript command must work) |
| RStudio | Optional but recommended |
| R package: vpc | install.packages("vpc") |
| R package: xpose | install.packages("xpose") |
| R package: xpose4 | install.packages("xpose4") |
| R package: tidyverse | install.packages("tidyverse") — required by xpose |
| R package: ggplot2 | install.packages("ggplot2") — required by vpc/xpose |
NMGUI2 (browsing, evaluating, comparing results) works without NONMEM, PsN, R or RStudio. These are only needed if you want to run models or generate VPCs from within the app.
xcode-select --install/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"brew install python
python3 --versionbrew install rOr download from https://cran.r-project.org/bin/macosx/
Verify:
Rscript --versionDownload from https://posit.co/download/rstudio-desktop/ and add to /Applications.
Make sure RStudio is accessible from the command line — NMGUI2 can launch it directly.
Open Terminal and run:
Rscript -e 'install.packages(c("vpc","xpose","xpose4","tidyverse","ggplot2"), repos="https://cran.r-project.org")'perl --versionIf missing:
brew install perlFollow the official guide at https://uupharmacometrics.github.io/PsN/install.html
Verify:
execute --versiongit clone https://github.com/robterheine/nmgui2.git
cd nmgui2pip3 install PyQt6 pyqtgraph numpy matplotlibpython3 nmgui2.pyCreate ~/Desktop/NMGUI2.command:
#!/bin/bash
cd /path/to/nmgui2
python3 nmgui2.pyMake it executable:
chmod +x ~/Desktop/NMGUI2.commandDouble-click in Finder to launch.
Download from https://www.python.org/downloads/windows/
During installation, tick:
- ✅ Add Python to PATH
- ✅ Install pip
Verify in Command Prompt:
python --version
pip --versionDownload from https://cran.r-project.org/bin/windows/base/
During installation, tick "Add R to system PATH" (or add manually: C:\Program Files\R\R-4.x.x\bin to PATH).
Verify:
Rscript --versionDownload from https://posit.co/download/rstudio-desktop/
Open Command Prompt or RStudio and run:
Rscript -e "install.packages(c('vpc','xpose','xpose4','tidyverse','ggplot2'), repos='https://cran.r-project.org')"Download Strawberry Perl from https://strawberryperl.com/ — this includes all required modules.
Verify:
perl --versionFollow the official guide at https://uupharmacometrics.github.io/PsN/install.html
Verify:
execute --versionDownload from https://git-scm.com/download/win
Open Command Prompt:
git clone https://github.com/robterheine/nmgui2.git
cd nmgui2pip install PyQt6 pyqtgraph numpy matplotlibpython nmgui2.pyCreate NMGUI2.bat in the nmgui2 folder:
@echo off
cd /d %~dp0
python nmgui2.pyDouble-click to launch.
Shown for Ubuntu/Debian. For Fedora replace apt with dnf; for Arch replace with pacman.
sudo apt update
sudo apt install -y python3 python3-pip git curl perl
python3 --versionsudo apt install -y libxcb-xinerama0 libxcb-cursor0 libxkbcommon-x11-0 \
libgl1-mesa-glx libegl1sudo apt install -y r-base r-base-devFor the latest R version, follow https://cran.r-project.org/bin/linux/ubuntu/
Verify:
Rscript --versionDownload the .deb installer from https://posit.co/download/rstudio-desktop/
sudo dpkg -i rstudio-*.deb
sudo apt --fix-broken installRscript -e 'install.packages(c("vpc","xpose","xpose4","tidyverse","ggplot2"), repos="https://cran.r-project.org")'Follow the official guide at https://uupharmacometrics.github.io/PsN/install.html
Verify:
execute --versiongit clone https://github.com/robterheine/nmgui2.git
cd nmgui2pip3 install PyQt6 pyqtgraph numpy matplotlibOr with a virtual environment (recommended):
python3 -m venv venv
source venv/bin/activate
pip install PyQt6 pyqtgraph numpy matplotlibpython3 nmgui2.pyCreate ~/.local/share/applications/nmgui2.desktop:
[Desktop Entry]
Type=Application
Name=NMGUI2
Exec=/bin/bash -c "cd /path/to/nmgui2 && python3 nmgui2.py"
Terminal=false
Categories=Science;On all platforms, from the nmgui2 directory:
git pullNo reinstallation of Python packages is needed unless a new dependency has been added.
- Launch the app (
python3 nmgui2.py) - Click Browse… or File → Open Directory (⌘O / Ctrl+O) and navigate to a folder containing
.modfiles - Click + Bookmark to save the directory for quick access
- Select a model row to view its parameters, output, and diagnostic plots
- Go to Settings (⌘6 / Ctrl+6) to configure PsN, NONMEM, and RStudio paths if they are not auto-detected from PATH
| Action | macOS | Windows / Linux |
|---|---|---|
| Models tab | ⌘1 | Ctrl+1 |
| Tree tab | ⌘2 | Ctrl+2 |
| Evaluation tab | ⌘3 | Ctrl+3 |
| VPC tab | ⌘4 | Ctrl+4 |
| History tab | ⌘5 | Ctrl+5 |
| Settings tab | ⌘6 | Ctrl+6 |
| Open directory | ⌘O | Ctrl+O |
| Rescan directory | ⌘R | Ctrl+R |
| Navigate model table | ↑ / ↓ | ↑ / ↓ |
| Jump to Output panel | Enter | Enter |
| Toggle star | Space | Space |
All settings are stored in ~/.nmgui/ (created automatically on first run):
| File | Contents |
|---|---|
settings.json |
Theme, paths, window geometry, splitter sizes |
model_meta.json |
Stars, comments, status tags, notes, parent model |
bookmarks.json |
Directory bookmarks |
runs.json |
Run history (last 200 entries) |
To reset all settings: delete the ~/.nmgui/ folder.
Contributions are very welcome. See CONTRIBUTING.md for details.
Areas particularly in need of help:
- Windows and Linux testing and bug reports
- Additional NONMEM output parsing (multiple estimation steps, SAEM, IMP, BAYES)
- New diagnostic plot types
- Documentation and tutorials
Rob ter Heine Hospital pharmacist – clinical pharmacologist Radboud Applied Pharmacometrics · Radboudumc, Nijmegen, the Netherlands
Developed with Claude Sonnet 4.6 by Anthropic.
MIT License — free to use, modify and distribute.
