Configuration
The settings file, its location on Linux and macOS, and the PIPELINER_* and RELION_* environment variables that override it
This page explains how to configure CCPEM-Pipeliner: where its settings file lives, how to read and modify it, and how environment variables let you override any setting without editing the file. Understanding configuration matters because pipeliner's defaults for MPI commands, queue submission, executable paths, and cluster templates are all drawn from one JSON file and a pair of PIPELINER_* / RELION_* environment variables — getting these right is the prerequisite for running any real processing job.
Before working with pipeliner configuration you need:
- Python ≥ 3.9 (tested on 3.10 in CI; declared compatible up to 3.14)
- ccpem-pipeliner installed via
pip install ccpem-pipeliner - Write access to your home directory (or the directory pointed to by
XDG_CONFIG_HOMEon Linux) so the settings file can be created on first run - Optional: a RELION installation, MPI runtime, or HPC scheduler if you intend to use those features — their paths and commands are what most settings control
Settings file location
When pipeliner is first imported it looks for — and if absent, creates — a JSON settings file named ccpem-pipeliner-settings.json:
| Platform | Default path |
|---|---|
| Linux | $XDG_CONFIG_HOME/ccpem/pipeliner/ccpem-pipeliner-settings.json (default ~/.config/ccpem/pipeliner/) |
| macOS | ~/Library/Application Support/ccpem/pipeliner/ccpem-pipeliner-settings.json |
If the settings file directory is not writable, pipeliner logs:
WARNING: CCP-EM Pipeliner could not create a settings file at <path>. Settings can still be set using environment variables.
and continues with built-in defaults.
Resolution order
For each setting, pipeliner checks (highest priority first):
PIPELINER_*environment variable (e.g.PIPELINER_QSUB_TEMPLATE)RELION_*environment variable fallback (e.g.RELION_QSUB_TEMPLATE)- Value in
ccpem-pipeliner-settings.json - Built-in default
Important timing notes:
PIPELINER_PATH_TO_SOURCE_FILESandPIPELINER_ADDITIONAL_PROGRAM_PATHSare applied once whenpipelineris imported (viaenv_setup.setup_python_environment). Changes to these variables after import have no effect in the current process.- All other settings (queue name, qsub template, qsub command, etc.) are re-read from environment variables on every getter call. Queue and MPI settings only supply the default values of job options, so a change affects job files and jobs created after it, not a
run.joborjob.starfile that already contains a value for that option. - The settings file itself is read once on first access within a process; edits to the file are not picked up until the process restarts.
Settings reference
Environment setup
| Setting key | Environment variable(s) | Default | Description |
|---|---|---|---|
path_to_source_files | PIPELINER_PATH_TO_SOURCE_FILES | [] | PATH-separated list of shell scripts to source at import time (e.g. CCP4 setup). These are not program search paths. |
additional_program_paths | PIPELINER_ADDITIONAL_PROGRAM_PATHS | [] | Directories prepended to PATH at import time so third-party executables are found. |
External programs
| Setting key | Environment variable(s) | Default | Description |
|---|---|---|---|
ctffind_executable | PIPELINER_CTFFIND_EXECUTABLE, RELION_CTFFIND_EXECUTABLE | ctffind | CTFFIND-4.1+ executable name or path. |
gctf_executable | PIPELINER_GCTF_EXECUTABLE, RELION_GCTF_EXECUTABLE | Gctf | Gctf executable. |
motioncor2_executable | PIPELINER_MOTIONCOR2_EXECUTABLE, RELION_MOTIONCOR2_EXECUTABLE | MotionCor2 | MotionCor2 executable. |
aretomo_executable | PIPELINER_ARETOMO_EXECUTABLE, RELION_ARETOMO_EXECUTABLE | AreTomo2 | AreTomo2 executable for tomography tilt-series alignment. |
batchtomo_executable | PIPELINER_BATCHTOMO_EXECUTABLE, RELION_BATCHTOMO_EXECUTABLE | batchruntomo | IMOD batchruntomo executable. |
resmap_executable | PIPELINER_RESMAP_EXECUTABLE, RELION_RESMAP_EXECUTABLE | ResMap-1.1.4-linux64 (Linux) / ResMap-1.1.4-mac64 (macOS) | ResMap local-resolution executable. |
topaz_executable | PIPELINER_TOPAZ_EXECUTABLE, RELION_TOPAZ_EXECUTABLE | relion_python_topaz if on PATH, else topaz | Topaz particle-picking executable. |
modelangelo_executable | PIPELINER_MODELANGELO_EXECUTABLE, RELION_MODELANGELO_EXECUTABLE | relion_python_modelangelo if on PATH, else modelangelo | ModelAngelo executable. |
dynamight_executable | PIPELINER_DYNAMIGHT_EXECUTABLE, RELION_DYNAMIGHT_EXECUTABLE | relion_python_dynamight if on PATH, else dynamight | DynaMight executable. |
modelcraft_executable | PIPELINER_MODELCRAFT_EXECUTABLE | modelcraft | ModelCraft executable. There is no RELION_MODELCRAFT_EXECUTABLE fallback. |
cryocare_executables_dir | PIPELINER_CRYOCARE_EXECUTABLES_DIR | "" (empty) | Directory containing cryoCARE executables for tomography jobs. No RELION fallback. |
MPI and parallelism
| Setting key | Environment variable(s) | Default | Description |
|---|---|---|---|
mpirun_command | PIPELINER_MPIRUN_COMMAND | mpirun -n XXXmpinodesXXX | Command prepended to MPI jobs. XXXmpinodesXXX is substituted with the job's MPI count. Sets the default mpi_command job option; it is not a global MPI override. |
default_nrmpi | PIPELINER_DEFAULT_NRMPI, RELION_QSUB_NRMPI | 1 | Default number of MPI processes. |
default_nrthreads | PIPELINER_DEFAULT_NRTHREADS, RELION_QSUB_NRTHREADS | 1 | Default number of threads per process. |
mpi_max | PIPELINER_MPI_MAX, RELION_MPI_MAX | None | Maximum MPI processes shown in GUI spinners. |
thread_max | PIPELINER_THREAD_MAX, RELION_THREAD_MAX | None | Maximum threads per process shown in GUI spinners. |
minimum_dedicated | PIPELINER_MINIMUM_DEDICATED, RELION_MINIMUM_DEDICATED | None | Minimum dedicated cores per node. |
warning_local_mpi | PIPELINER_WARNING_LOCAL_MPI, RELION_WARNING_LOCAL_MPI | None | Warn when local jobs request more than this many MPI processes. |
Queue / cluster submission
Queue submission is controlled by one primary boolean setting plus three related settings. Whether a specific job is actually submitted to the queue is determined per-job by that job's do_queue option, not globally.
| Setting key | Environment variable(s) | Default | Description |
|---|---|---|---|
queue_use | PIPELINER_QUEUE_USE, RELION_QUEUE_USE | false | Sets the default value of each new job's do_queue option at job-creation time. Accepted true values (case-insensitive): yes, true, y, 1. All other values are false. |
qsub_command | PIPELINER_QSUB_COMMAND, RELION_QSUB_COMMAND | qsub | The command used to submit jobs to the cluster scheduler. |
queue_name | PIPELINER_QUEUE_NAME, RELION_QUEUE_NAME | openmpi | Default queue name substituted into XXXqueueXXX in qsub templates. |
qsub_template | PIPELINER_QSUB_TEMPLATE, RELION_QSUB_TEMPLATE | "" (empty string) | Path to the submission script template. Sets the default of each new job's Standard submission script: (qsubscript) option. If a job with queue submission enabled has an empty or missing template, run_job raises ValueError('Job cannot be run because: ...') and no job is created; RuntimeError('Error starting job <dir>') only occurs when an already-scheduled job is started and its template can no longer be read. |
qsub_extra_count | PIPELINER_QSUB_EXTRA_COUNT, RELION_QSUB_EXTRA_COUNT | 0 | Number of extra XXXextraNXXX placeholders in the qsub template. |
scratch_dir | RELION_SCRATCH_DIR | "" | Scratch directory for temporary files. This is the only setting with no PIPELINER_-prefixed variable. |
qsub template placeholders
The template supports these fixed substitution tokens:
| Placeholder | Substituted value |
|---|---|
XXXnameXXX | Job output directory |
XXXmpinodesXXX | Number of MPI processes |
XXXcoresXXX | MPI processes × threads |
XXXdedicatedXXX | Minimum dedicated cores |
XXXthreadsXXX | Threads per process |
XXXqueueXXX | Queue name |
XXXcommandXXX | Job runner command |
XXXerrfileXXX | Standard error file |
XXXoutfileXXX | Standard output file |
XXXextra1XXX … XXXextraNXXX | Per-job qsub_extra_1 … qsub_extra_N values |
Unrecognised placeholders (including misspelt known ones) trigger a RuntimeWarning. The template must not contain an mpirun or mpiexec command; MPI is controlled per-job via the mpi_command job option.
qsub extra variables
For each n from 1 to qsub_extra_count, three environment variables are recognised:
PIPELINER_QSUB_EXTRA<N>/RELION_QSUB_EXTRA<N>— label for the extra optionPIPELINER_QSUB_EXTRA<N>_DEFAULT/RELION_QSUB_EXTRA<N>_DEFAULT— default valuePIPELINER_QSUB_EXTRA<N>_HELP/RELION_QSUB_EXTRA<N>_HELP— help text
Each extra maps to a job option named qsub_extra_<N> whose value is substituted into XXXextraNXXX at submission time.
OneDep / EMPIAR deposition
| Setting key | Environment variable(s) | Default | Description |
|---|---|---|---|
onedep_config_path | PIPELINER_ONEDEP_CONFIG_PATH | <settings_dir>/onedep/config.toml | Path to the OneDep credential config TOML file. Linux default: ~/.config/ccpem/pipeliner/onedep/config.toml; macOS default: ~/Library/Application Support/ccpem/pipeliner/onedep/config.toml. |
onedep_session_dir | PIPELINER_ONEDEP_SESSION_DIR | .onedep_sessions | Directory (relative to the working directory) used to store OneDep deposition session state. |
CCP-EM GUI integration
| Setting key | Environment variable(s) | Default | Description |
|---|---|---|---|
ccpem_share_dir | PIPELINER_CCPEM_SHARE_DIR | auto-detected from ccpem-python path | Path to the CCP-EM share directory for rvapi display objects. |
Checking your configuration
After installation, run the setup checker to verify that pipeliner finds all required executables and console scripts:
pipeliner.check_setup
The output has four sections: Python version, available job types, pipeliner console scripts, and a final report. A clean install on a workstation without RELION will report "The pipeliner is correctly installed, but some jobs are unavailable" — that is normal. "The pipeliner is not installed correctly" means a console script is missing; fix it with:
pip install --force-reinstall ccpem-pipeliner
Editing the settings file
Open ~/.config/ccpem/pipeliner/ccpem-pipeliner-settings.json (Linux) or ~/Library/Application Support/ccpem/pipeliner/ccpem-pipeliner-settings.json (macOS) in any text editor. The file is plain JSON. For example, to point pipeliner at a specific MotionCor2 build:
{
"motioncor2_executable": "/software/motioncor2/2.1.0/MotionCor2",
"default_nrmpi": 4,
"default_nrthreads": 8
}
Settings file changes take effect the next time you start a new Python process; they are not re-read mid-session.
Overriding settings with environment variables
Environment variables take precedence over the settings file and are checked on every getter call. Set them in your shell profile, in a module file (on HPC), or inline before a command:
# Use a site-wide MotionCor2 binary
export PIPELINER_MOTIONCOR2_EXECUTABLE=/opt/motioncor2/MotionCor2
# Use a SLURM submission command instead of the default qsub
export PIPELINER_QSUB_COMMAND=sbatch
# Point at your facility's qsub template
export PIPELINER_QSUB_TEMPLATE=/etc/pipeliner/slurm_template.sh
# Enable queue submission by default for all new jobs
export PIPELINER_QUEUE_USE=yes
# Set the queue/partition name
export PIPELINER_QUEUE_NAME=gpu
# Use 4 MPI processes by default
export PIPELINER_DEFAULT_NRMPI=4
# Add site software to PATH for pipeliner to find executables
export PIPELINER_ADDITIONAL_PROGRAM_PATHS=/opt/relion/bin:/opt/ctffind/bin
PIPELINER_ADDITIONAL_PROGRAM_PATHS and PIPELINER_PATH_TO_SOURCE_FILES must be set before importing pipeliner (i.e. before any pipeliner command runs); all other variables can be set at any time.
Sourcing environment setup scripts
If your site packages (e.g. CCP4) require sourcing a shell script to populate environment variables, list the scripts in PIPELINER_PATH_TO_SOURCE_FILES:
export PIPELINER_PATH_TO_SOURCE_FILES=/opt/ccp4-9/bin/ccp4.setup-sh
Multiple scripts are separated by :. These scripts are sourced before job execution so their environment is inherited by the job process. This is not a search path for executables — use PIPELINER_ADDITIONAL_PROGRAM_PATHS for that.
Accessing settings programmatically
Use the getter functions in pipeliner.user_settings:
from pipeliner import user_settings
print(user_settings.get_mpirun_command()) # 'mpirun -n XXXmpinodesXXX'
print(user_settings.get_qsub_command()) # 'qsub'
print(user_settings.get_queue_name()) # 'openmpi'
print(user_settings.get_queue_use()) # False
print(user_settings.get_ctffind_executable()) # 'ctffind'
print(user_settings.get_default_nrmpi()) # 1
print(user_settings.get_qsub_extra_count()) # 0
These functions always reflect the current environment variables, so you can change a variable mid-script and the next call will pick it up (except for path and source-file settings, which are applied at import time).
Configuring OneDep credentials
Create the OneDep credential file from your refresh token using:
pipeliner.setup_onedep_credentials
By default the credential file is written to ~/.config/ccpem/pipeliner/onedep/config.toml (Linux) or ~/Library/Application Support/ccpem/pipeliner/onedep/config.toml (macOS). Override the path with PIPELINER_ONEDEP_CONFIG_PATH.
Example 1 — Read the current MPI command from the Python API
from pipeliner import user_settings
mpi_cmd = user_settings.get_mpirun_command()
print(mpi_cmd)
Example 2 — Override the CTFFIND executable via environment variable, then read it back
import os
os.environ["PIPELINER_CTFFIND_EXECUTABLE"] = "/opt/ctffind/4.1.14/ctffind"
from pipeliner import user_settings
print(user_settings.get_ctffind_executable())
# /opt/ctffind/4.1.14/ctffind
Example 3 — Minimal settings file for an HPC cluster with SLURM
Create or edit ~/.config/ccpem/pipeliner/ccpem-pipeliner-settings.json:
{
"qsub_command": "sbatch",
"qsub_template": "/etc/pipeliner/slurm_template.sh",
"queue_name": "em_queue",
"queue_use": false,
"default_nrmpi": 4,
"default_nrthreads": 8,
"mpirun_command": "mpirun -n XXXmpinodesXXX",
"motioncor2_executable": "/opt/motioncor2/MotionCor2",
"ctffind_executable": "/opt/ctffind/bin/ctffind",
"additional_program_paths": ["/opt/relion/bin", "/opt/ctffind/bin"]
}
queue_use is left false so jobs run locally by default; individual jobs can still be submitted to the queue by setting their do_queue option to Yes.
Example 4 — qsub template with extra variables
Set qsub_extra_count to 1 and define the extra variable:
export PIPELINER_QSUB_EXTRA_COUNT=1
export PIPELINER_QSUB_EXTRA1="Account name"
export PIPELINER_QSUB_EXTRA1_DEFAULT="em_project"
export PIPELINER_QSUB_EXTRA1_HELP="Your HPC project account name"
Then reference XXXextra1XXX in your template:
#!/bin/bash
#SBATCH --job-name=XXXnameXXX
#SBATCH --ntasks=XXXmpinodesXXX
#SBATCH --cpus-per-task=XXXthreadsXXX
#SBATCH --partition=XXXqueueXXX
#SBATCH --account=XXXextra1XXX
#SBATCH --output=XXXoutfileXXX
#SBATCH --error=XXXerrfileXXX
XXXcommandXXX
Do not include mpirun or mpiexec in the template; MPI is handled per-job via the mpi_command job option.
Example 5 — Verify the installation and configuration
pipeliner.check_setup
A correctly installed system with some unavailable jobs (expected on a workstation without RELION) ends with:
===========================
The pipeliner is correctly installed, but some jobs are unavailable
===========================
If a console script is missing the final line reads The pipeliner is not installed correctly. Reinstall to fix:
pip install --force-reinstall ccpem-pipeliner
Example 6 — Read qsub extra settings programmatically
from pipeliner import user_settings
count = user_settings.get_qsub_extra_count()
for n in range(1, count + 1):
extras = user_settings.get_qsub_extras(n)
print(extras)
# {'name': '...', 'default': '...', 'help': '...'}
Settings file not created
Symptom: No ccpem-pipeliner-settings.json file appears after first use; log shows CCP-EM Pipeliner could not create a settings file at <path>.
Cause: The settings directory (~/.config/ccpem/pipeliner/ on Linux) is not writable.
Fix: Create the directory manually and ensure it is writable, then re-run:
mkdir -p ~/.config/ccpem/pipeliner
chmod u+rwx ~/.config/ccpem/pipeliner
Alternatively, use environment variables instead of the file; they work even when no file can be written.
RuntimeError on first settings access
Symptom: Importing pipeliner succeeds, but RuntimeError is raised the first time any setting is read.
Cause: pipeliner is running on an unsupported platform (not Linux or macOS).
Fix: pipeliner logs Unable to set up pipeliner python environment at import and raises RuntimeError lazily on first setting access. Use a supported OS. If you are on a supported OS, check that platform.system() returns 'Linux' or 'Darwin'.
Environment variable changes have no effect on path/source settings
Symptom: Changing PIPELINER_ADDITIONAL_PROGRAM_PATHS or PIPELINER_PATH_TO_SOURCE_FILES after pipeliner is already imported does not update PATH.
Cause: These settings are applied once during pipeliner.__init__ via env_setup.setup_python_environment(). Later changes to the environment variables are ignored for the current process.
Fix: Export the variables before starting the Python process:
export PIPELINER_ADDITIONAL_PROGRAM_PATHS=/software/relion/bin
python my_script.py
External program marked unavailable despite being installed
Symptom: pipeliner.check_setup shows '<command>' missing from system path for a program that is installed.
Cause: The executable is not on the PATH that pipeliner sees at import time. PIPELINER_ADDITIONAL_PROGRAM_PATHS may not have been set, or the wrong directory was listed.
Fix:
- Confirm the binary path:
which MotionCor2(or the relevant executable). - Add the containing directory to
PIPELINER_ADDITIONAL_PROGRAM_PATHSbefore importing pipeliner:export PIPELINER_ADDITIONAL_PROGRAM_PATHS=/path/to/bin - Or set the specific executable environment variable (e.g.
PIPELINER_MOTIONCOR2_EXECUTABLE=/full/path/MotionCor2). - Re-run
pipeliner.check_setup.
Queue submission fails with Error reading template submission script
Symptom: A previously scheduled job (for example one started by a schedule or by PipelinerProject.run_scheduled_job()) is marked Failed immediately with RuntimeError('Error starting job <dir>') and the underlying cause is ValueError('Error reading template submission script in: <path>').
Cause: The job's do_queue option (Submit to queue?) is Yes but its qsubscript option (Standard submission script:) points to a file that does not exist when the job is started. New jobs take the defaults for these options from queue_use (via PIPELINER_QUEUE_USE or the settings file) and qsub_template. pipeliner --run_job checks the template before creating the job, so there a missing template fails up front with ValueError: Job cannot be run because: File <path> not found and no job is added. An empty template path is likewise rejected before the job is created.
Fix: Either provide a valid template path:
export PIPELINER_QSUB_TEMPLATE=/path/to/your/slurm_template.sh
Or disable queue submission:
export PIPELINER_QUEUE_USE=no
Note that these variables only change the defaults for new jobs: existing jobs whose do_queue option is already set to Yes in their run.job or job.star files will still be submitted, using their own qsubscript value; edit those files to set Submit to queue? == No to run them locally, or to point Standard submission script: at a valid template.
Console scripts (pipeliner, pipeliner.check_setup, etc.) not found
Symptom: Running pipeliner or pipeliner.check_setup gives command not found.
Cause: Entry points were not installed correctly (e.g. after editing pyproject.toml without reinstalling).
Fix:
pip install --force-reinstall ccpem-pipeliner
RELION environment variables not picked up
Symptom: Setting RELION_QSUB_TEMPLATE has no effect.
Cause: A PIPELINER_QSUB_TEMPLATE environment variable is set (even to an empty string) and has higher priority than the RELION fallback. A value in the settings file cannot cause this: environment variables (PIPELINER_* first, then RELION_*) are checked before the settings file. Also check that the setting has a RELION_* fallback at all; some, such as mpirun_command, only accept the PIPELINER_* variable.
Fix: Check for competing settings:
printenv | grep -E 'PIPELINER_QSUB|RELION_QSUB'
Remove or unset the higher-priority variable, or switch to the PIPELINER_* form to be explicit:
unset PIPELINER_QSUB_TEMPLATE
export RELION_QSUB_TEMPLATE=/path/to/template.sh
Settings file edits not reflected in running process
Symptom: You edited ccpem-pipeliner-settings.json but the old values are still being used.
Cause: The settings file is read once per process on first access. Subsequent reads within the same process use the cached values.
Fix: Restart the Python process (or pipeliner CLI command). Alternatively, use environment variables, which are re-checked on every getter call:
export PIPELINER_QUEUE_NAME=new-queue