# Software stacks

Analysis software at Purdue AF can come from several sources, listed here from most to least recommended:

1. **Pixi environments** — the recommended way to manage analysis software.
2. **Conda environments** — supported; use Pixi for new projects.
3. **LCG stacks** distributed via CVMFS — useful for special cases such as [CUDA-enabled ROOT](<https://analysis-facility.physics.purdue.edu/guide-roofit-cuda/index.md>).
4. **Apptainer/Singularity images** via CVMFS — a last resort for software that requires a different operating system.

## Pixi environments

[Pixi](<https://pixi.sh/>) is a modern package manager and a successor of Conda/Mamba. It is significantly faster than Conda, resolves Conda and PyPI dependencies together, and enforces reproducibility via lock files.

Unlike Conda environments, Pixi environments are meant to be **project-specific**: the environment definition (`pixi.toml`) and the environment itself live in the project directory, next to your analysis code. A detailed guide on how to start using Pixi is available here: [Pixi guide](<https://analysis-facility.physics.purdue.edu/guide-pixi/index.md>).

### The global Pixi environment

In addition to project-specific environments, we provide a **global Pixi environment** at `/work/pixi/global/`, which contains all common HEP analysis packages and ML libraries. It is a good starting point for new projects and for code that is not part of any Pixi project.

> [!NOTE]
>
> **List of packages in the global environment (pixi.toml configuration)**
>
> `/work/pixi/global/` is released with the Purdue AF image, and its `version` field names that release. Changes for the next release collect in [`pixi/global/pixi.toml`](<https://github.com/PurdueAF/purdue-af/blob/main/pixi/global/pixi.toml>). The released environment:
>
> ```toml
> [workspace]
> authors = ["Dmitry Kondratyev"]
> channels = ["conda-forge"]
> name = "pixi-global"
> # The cuda entry is the __cuda virtual package the GPU builds need.
> platforms = [{ platform = "linux-64", cuda = "12.4" }]
> # A lock written by a newer pixi is not readable by an older one.
> requires-pixi = ">=0.81"
> # The purdue-af release: X.Y.Z at its tag, X.Y.Z+dev on every commit after it (bump-af-version.py).
> version = "0.14.5"
>
> [dependencies]
> awkward = "*"
> awkward-pandas = "*"
> # distributed <2026.8.0 cannot stop a bokeh >=3.10 dashboard; dask-awkward holds distributed <2025.4.0.
> bokeh = "3.9.*"
> cabinetry = "*"
> cms-combine = "==11.1.0"
> coffea = "2026.9.0.*"
> correctionlib="*"
> dask = "*"
> dask-gateway = "*"
> dask-histogram = "*"
> dask-jobqueue = "*"
> dask-memusage = "*"
> dask-ml = "*"
> distributed = "*"
> eigen = "*"
> fsspec-xrootd = "*"
> graphviz = "*"
> gpustat = "*"
> gsl = "*"
> gxx_linux-64 = "*"
> h5py = "<3.16.1"
> hepdata-lib = "*"
> hist = "*"
> ipykernel = "*"
> ipympl = "*"
> ipywidgets = "*"
> jupyter = "*"
> jupyter-sshd-proxy = "0.3.0.*"
> law = "*"
> lhapdf = "*"
> lmfit = "*"
> mamba = "*"
> matplotlib-base = "*"
> mimesis = "*"
> # floor: an unconstrained solve can pick mlflow 1.x, whose protos fail under protobuf >= 4
> mlflow = ">=3"
> mplhep = ">=1.1.2"
> numba = "*"
> numpy = "*"
> omegaconf = "*"
> openssh = "*"
> optuna = "*"
> pandas = "*"
> particle = "*"
> pip = "*"
> plotly = "*"
> py-spy = "*"
> pyarrow = "*"
> pycurl = "*"
> pydot = "*"
> pyhf = "*"
> pyjuliacall = "*"
> pytest = "*"
> python = "3.13.*"
> python-graphviz = "*"
> pytorch = "2.14.*"
> # floor: Ray Train clusters run from this env, with Ray's token authentication (2.52+)
> ray-default = ">=2.52"
> ray-train = "*"
> rucio-clients = "*"
> root = ">=6.40.2,<6.41"
> scikit-learn = "*"
> scikit-optimize = "*"
> scipy = "*"
> seaborn = "*"
> tbb = "*"
> torch-geometric = "*"
> tqdm = "*"
> uncertainties = "*"
> uproot = "*"
> vdt = "*"
> vector = "*"
> wrapt = "<2"
> xgboost = "*"
> # The version pixi/base pins; root_base links libxrootd 6.x on its own.
> xrootd = "5.9.2.*"
> zuko = "*"
>
> [pypi-dependencies]
> cmsstyle = "*"
> dbs3-client = "*"
> phyprakit = "*"
> scalpl = "*"
> servicex = "==3.3.1"
> termplotlib = "*"
> xgbfir = "*"
> roastcoffea = "*"
> pyroscope-io = "*"
> ```

If a package that you consider common is missing from the global environment, [let us know](<https://analysis-facility.physics.purdue.edu/support/index.md>) — we update it regularly.

## Jupyter kernels

We provide multiple types of Jupyter kernels to execute analysis code in notebooks.

### Pixi kernels

There is no one-to-one mapping between Pixi environments and Jupyter kernels. Instead, we provide two special Pixi kernels:

- **Python (pixi global)** — always uses the global environment at `/work/pixi/global/`.
- **Python (pixi project-aware)** — uses the Pixi project that contains the notebook: the nearest `pixi.toml`, or `pyproject.toml` with a `[tool.pixi]` table, in the notebook's directory or one of its parents. It never uses the global environment: for a notebook outside any Pixi project, choose **Python (pixi global)**.

Before starting, the project-aware kernel runs `pixi install` for the project's environment. When it finds no project, or cannot use the one it finds, the kernel still starts, but every cell fails with the error that stopped it. To be usable, the project must:

- have the `ipykernel` package in its environment;
- be writable by you — a shared project on `/depot/` owned by someone else, or `/work/pixi/global/` itself, is not; copy its `pixi.toml` into a project of your own ([Pixi guide](<https://analysis-facility.physics.purdue.edu/guide-pixi/index.md>)), or use **Python (pixi global)**;
- not be under `/home/` ([Pixi storage locations](<https://analysis-facility.physics.purdue.edu/guide-pixi/index.md#storage-locations>));
- be stored in a [publicly readable directory](<https://analysis-facility.physics.purdue.edu/storage/index.md#storing-custom-pixi-or-conda-environments>).

### Conda kernels

Conda environments are discovered automatically and appear as kernels if they have the `ipykernel` package installed and are stored in a [publicly readable directory](<https://analysis-facility.physics.purdue.edu/storage/index.md#storing-custom-pixi-or-conda-environments>) — see [Conda environments](<https://analysis-facility.physics.purdue.edu/guide-conda/index.md>).

## Analysis tools

All of these but PocketCoffea are in the global Pixi environment; the [CMS Common Analysis Tools documentation](<https://cms-analysis.docs.cern.ch>) covers more.

- [ROOT](<https://root.cern>) and [PyROOT](<https://root.cern/manual/python/>) — in a terminal, `pixi shell` in `/work/pixi/global/`, then `root -l`. Canvases and `TBrowser` cannot open, since there is no X11 forwarding; in a notebook, `TCanvas::Draw` displays plots. To run RooFit fits on a GPU, see [RooFit on GPUs](<https://analysis-facility.physics.purdue.edu/guide-roofit-cuda/index.md>).
- [Coffea](<https://coffea-hep.readthedocs.io/>) — columnar analysis in Python.
- [PocketCoffea](<https://pocketcoffea.readthedocs.io/en/stable/>) — a declarative framework on top of Coffea, installed in your own environment; its [dask@purdue-af executor](<https://pocketcoffea.readthedocs.io/en/stable/running.html#executors-availability>) runs on [Dask Gateway](<https://analysis-facility.physics.purdue.edu/guide-dask-gateway/index.md>).
- [RDataFrame](<https://root.cern.ch/doc/master/group__tutorial__dataframe.html>) — in C++ or Python, in any environment that has ROOT.
- [Combine](<https://cms-analysis.github.io/HiggsAnalysis-CombinedLimit/>) (package `cms-combine`) — see [Running Combine](<https://analysis-facility.physics.purdue.edu/guide-combine/index.md>).

## CMSSW

CMSSW releases are available via CVMFS in the usual way:

```shell
source /cvmfs/cms.cern.ch/cmsset_default.sh
cmsrel CMSSW_13_0_13
cd CMSSW_13_0_13/src
cmsenv
```

Note that Purdue AF is based on an EL8 system (RHEL8-compatible, `el8`/`slc8` architectures), so CMSSW releases built for other architectures (e.g. `slc7`) must be run inside an Apptainer container such as `cmssw-el7` (see below, and the [MC generation guide](<https://analysis-facility.physics.purdue.edu/guide-mc-gen/index.md>) for a worked example).

## Apptainer / Singularity images

In rare cases when you need to run code that requires a specific operating system, you can load Apptainer/Singularity images via CVMFS.

Example of loading an Apptainer image based on EL7:

```text
$ /cvmfs/cms.cern.ch/common/cmssw-el7
Singularity>
```

> [!WARNING]
>
> Your Analysis Facility session already runs in a Docker container. Launching Apptainer inside the AF session leads to a "container-in-container" setup, which is not guaranteed to always work as intended.
>
> We do not recommend using Apptainer at Purdue AF unless it is absolutely needed.
