Installing HEASoft using Conda

The conda distribution of HEASoft and Xspec are experimental. Please report issues to the Help Desk.

Introduction

Starting with HEASoft version 6.35, HEASoft and Xspec are also distributed as conda packages. The packages are available from a custom channel hosted by the HEASARC and are built from the same source code available via download from our site.

Quick Start

After installing conda (e.g. through miniforge), install heasoft in a new henv environment by running:

mamba create -n henv heasoft \
  -c https://heasarc.gsfc.nasa.gov/FTP/software/conda/ \
  -c conda-forge

Then activate the newly created environment and start using HEASoft.

conda activate henv

If you are interested only in xspec and no mission tools, do:

mamba create -n henv xspec \
  -c https://heasarc.gsfc.nasa.gov/FTP/software/conda/ \
  -c conda-forge

Note that to use xspec, you will also need to install the xspec-data package along with the heasoft or xspec packages above, or add it after the installation with:

mamba install -n henv xspec-data \
  -c https://heasarc.gsfc.nasa.gov/FTP/software/conda/

Note:

xspec-data is required to use the Xspec models in both the heasoft and xspec packages.
xstar-data is also required if you plan to use XSTAR.

Available Packages

The following packages are currently available through the HEASARC's conda channel:

  • heasoft (6.35 and above): Contains the full HEASoft distribution, including mission software and xspec (~300 MB)
  • xspec (12.15.0 and above): Contains Xspec and its dependencies only. No mission software (~ 90 MB)
  • xspec-data: Contains Xspec model files (> 3GB). Install this package along with xspec or heasoft if you plan to use Xspec
  • xstar-data: Contains the xstar data files. Install this package along with heasoft if you plan to use XSTAR.
  • xspec-compilers: Contains the compilers used to build xspec. Install this if you plan to build local Xspec models.

Installation

To minimize conflict with other software, we recommend installing heasoft into a separate conda environment.

Installing Conda (miniforge)

For details instructions, please follow the documentation in the miniforge page. The step are:
  1. Install miniforge:
    curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
    
    bash Miniforge3-$(uname)-$(uname -m).sh
    
    # add conda initialization
    conda init
  2. Start a new terminal for the initialization command to take effect.

Installing HEASoft (or XSPEC)

  1. Install HEASoft into a new conda environment (called henv):
    mamba create -n henv heasoft \
      -c https://heasarc.gsfc.nasa.gov/FTP/software/conda/ \
      -c conda-forge
    
    or the same for the xspec pacakge:
    mamba create -n henv xspec \
      -c https://heasarc.gsfc.nasa.gov/FTP/software/conda/ \
      -c conda-forge

    Wait for the installation to finish.

  2. Activate the newly created conda environment:
    conda activate henv

    The prompt should change to something like (henv)[...]. HEASoft should be initialized automatically.

  3. Start using HEASoft.

  4. If you plan to use xspec, make sure you add the model files available in the xspec-data package when installing heasoft:
    mamba create -n henv heasoft xspec-data \
      -c https://heasarc.gsfc.nasa.gov/FTP/software/conda/
       -c conda-froge
  5. Likewise, if you plan to use xstar, add the xstar-data package:
    mamba create -n henv heasoft xstar-data \
      -c https://heasarc.gsfc.nasa.gov/FTP/software/conda/
      -c conda-forge

Add to an Existing Environment

If you created the environment first without installing HEASoft, and then installed HEASoft separately, you may need to deactivate and reactivate the henv environment to setup heasoft.

conda deactivate
conda activate henv

Alternatively, HEASoft can be initialized manually by running the following inside the activated environment:

export HEADAS=$CONDA_PREFIX/heasoft
source $HEADAS/headas.sh

Additional Notes for XSPEC and XSTAR Users

  • Using xspec require installing the XSPEC data files, distributed as a separate package called xspec-data (~ 3GB). You can add it when installing heasoft by:
    mamba install -n henv heasoft xspec-data \
      -c https://heasarc.gsfc.nasa.gov/FTP/software/conda/ \
      -c conda-forge
  • In addition to being distributed as part of the heasoft package. Xspec is also available as a stand-alone package, which can be installed similar to heasoft.
    mamba install -n henv xspec xspec-data \
      -c https://heasarc.gsfc.nasa.gov/FTP/software/conda/ \
      -c conda-forge
  • If you plan to build local Xspec models, you will need to install the xspec-compilers package as well, then follow the standard Xspec instructions for building local models.
  • Similar to Xspec, If you plan to use XSTAR, you will need to install the xstar-data package as well. You can add it when installing heasoft by:
    mamba install -n henv heasoft xstar-data \
      -c https://heasarc.gsfc.nasa.gov/FTP/software/conda/ \
      -c conda-forge

Help & Feedback

If you encounter any issues during installation, please contact us for troubleshooting assistance.