License
See the license conditions.
Release Notes
Table of Contents
- Install via a package manager
- Download a pre-compiled binary distribution
- Build from source
- Run in a Docker container
- Appendix:
Install via a package manager
Python API
pygemc is available from PyPI.
Use a virtual environment for direct pip installs:
python3 -m venv ~/venv/pygemc
source ~/venv/pygemc/bin/activate
python -m pip install pygemc
The optional Jupyter modules used by PyVista VTK export can be installed with:
python -m pip install "pygemc[jupyter]"
The optional ROOT-file analysis dependencies can be installed with:
python -m pip install "pygemc[root]"
PyPI does not install the gemc executable but can be used to
create and visualize geometry or analyze results.
Download a pre-compiled binary distribution
Linux binary tarballs contain the gemc executable and the examples (but not pygemc).
Make sure to check the Software Prerequisites for binary installation before unpacking the tarball.
Choose an installation directory first:
gemc_home=/path/to/gemc
mkdir -p "$gemc_home"
cd "$gemc_home"
Then, use the commands from the tab that matches your Linux distribution and CPU architecture. This will install GEMC and the Geant4 data files.
After the installation, source the GEMC environment file. This step could
go into your .bashrc or .zshrc file:
source /path/to/gemc/gemc.env
Run a few checks to verify the installation;
gemc -v
test_gdynamic_plugin_load
test_gdata_event_verbose
Build from Source
You will need Geant4 to build GEMC. Check the Software Prerequisites and Geant4 Installation for the GEMC build in the appendix for the complete list of requirements.
1. Obtain the source
Set the versioned installation prefix once, so you can copy and paste the commands below. Change gprefix
to the GEMC version and location you want to install.
gprefix=/path/to/gemc/0.2
The source code will be cloned into $gprefix/source, and GEMC will be installed into $gprefix.
For the development release, set gprefix=/path/to/gemc/dev and use the development tab.
Download the code:
2. Compile and install GEMC
The Meson build system is used to compile and install GEMC.
The setup phase will check for the required dependencies and fetch external libraries.
Here we use a build directory inside source:
cd "$gprefix/source"
meson setup build --native-file=core.ini --prefix="$gprefix"
The compile phase will build the code and external libraries. The install phase will copy the binaries, libraries, and python modules to the installation directory.
meson compile -C build
meson install -C build
Optionally, after installation, run meson test -C build -v to test the configured GEMC build.
Build Options
- The setup option
-Droot=enabledwill add ROOT support (needs ROOT installed on your system). - The setup option
-Di_test=truewill enable the GUI interfaces in the tests. - Use
-vat build time for verbose output. - To wipe out the build directory and start over, use
rm -rf buildand then re-run setup. - Use
-jNto set the number of threads during compilation.
Post Installation
Add these lines to your shell configuration file (e.g. ~/.bashrc or ~/.zshrc):
export gprefix=/path/to/gemc/0.2
export PATH=$gprefix/bin:$gprefix/python_env/bin:$PATH
The second PATH entry adds the bundled Python
virtual environment so that python3 resolves to the venv interpreter — making import pygemc
available in your scripts without any activation step or separate pip install. It also exposes the
gemc-analyzer and gemc-system-template command-line tools.
Check the installed simulator and Python tools with:
gemc -v
gemc-system-template --help
gemc-analyzer --help
Run in a Docker container
You can use Docker to run GEMC. The available images are listed below.
Both arm64 and amd64 are supported (except on Arch Linux images which are amd64 only 1).
| OS | GEMC Version | Registry address | arm64 | amd64 |
|---|---|---|---|---|
| AlmaLinux 10 | dev | ghcr.io/gemc/src:dev-almalinux-10 |
true | true |
| ArchLinux latest | dev | ghcr.io/gemc/src:dev-archlinux-latest |
false | true |
| Debian 13 | dev | ghcr.io/gemc/src:dev-debian-13 |
true | true |
| Fedora 44 | dev | ghcr.io/gemc/src:dev-fedora-44 |
true | true |
| Ubuntu 24.04 | dev | ghcr.io/gemc/src:dev-ubuntu-24.04 |
true | true |
| Ubuntu 26.04 | dev | ghcr.io/gemc/src:dev-ubuntu-26.04 |
true | true |
It is recommended to bind a local directory to save and store your work.
For illustration purposes, below we will bind the image path /mywork
to the local dir ~/mywork and we will use the image ghcr.io/gemc/src:dev-almalinux-10.
archlinux amd64 images.
Batch mode
docker run -it --rm -v ~/mywork:/mywork ghcr.io/gemc/src:dev-almalinux-10 bash
Use a browser for the graphical interface:
Set these convenience variables for the interactive (choose your own password):
VPORTS=(-p 6080:6080 -p 5900:5900)
VNC_PASS=(-e X11VNC_PASSWORD=change-me)
VNC_BIND=(-e VNC_BIND=0.0.0.0)
GEO_FLAGS=(-e GEOMETRY=1920x1200)
docker run -it --rm -v ~/mywork:/mywork $VPORTS $VNC_BIND $VNC_PASS $GEO_FLAGS ghcr.io/gemc/src:dev-almalinux-10
Then point your browser to http://localhost:6080/vnc.html to access the
graphical interface.
Run using Apptainer
Linux hosts can use apptainer (formerly singularity) to run Docker containers.
You can use it with the Docker images above. It runs similarly to Docker, but the entrypoint needs to be
sourced explicitly.
apptainer exec --cleanenv --bind ~/mywork:/mywork docker://ghcr.io/gemc/src:dev-almalinux-10 bash
Then:
source /usr/local/bin/docker-entrypoint.sh
gemc -v
Warning
The graphical interface, in particular OpenGL windows, may not work properly in apptainer if connecting to a remote host
Note
Apptainer uses a default cache directory to store the images. If that becomes full, one can use environment variables to point to a location with enough disk space. For example, set
sim_cacheto somewhere with enough space:export sif_cache=/path/to/$USER/cachethen set these variables:
export APPTAINER_CACHEDIR=$sif_cache/apptainer-cache export APPTAINER_TMPDIR=$sif_cache/apptainer-tmp export TMPDIR=$sif_cache/apptainer-tmpand run apptainer again.
Appendix
Software Prerequisites for binary installation
Binary tarball installations need only the runtime packages required by the gemc executable and the tools used
to download and unpack the archive. ROOT is intentionally not included in this list.
Software Prerequisites and Geant4 Installation for the GEMC build
-
Builders and compilers:
-
System Packages (typically installed with your system package manager):
One-line installation commands for basic packages and dependencies on MacOS and some popular Linux distributions:
-
External libraries, compiled from source against the same C++ Standard as GEMC (C++17 by default):
Important
GEMC can use any custom installation of CLHEP/Xerces-C/Geant4, however
we recommend using the g4install repository to install Geant4,
as it provides coexistence of multiple Geant4 versions and installation scripts.
Supported and tested platforms
-
MacOS: 26
- AlmaLinux: 10
- ArchLinux: latest
- Debian: 13
- Fedora: 44
- Ubuntu: 24.04
- Ubuntu: 26.04
-
For Apple Silicon Mac add the option
--platform linux/amd64to thedocker runcommand if you want to use the ↩