Installation

Using Anaconda

The recommended way to install Gammapy is to install the Anaconda distribution from https://www.anaconda.com/download/ and then to install the Gammapy and it’s dependencies by executing these commands in a terminal:

curl -O https://gammapy.org/download/install/gammapy-0.18.1-environment.yml
conda env create -f gammapy-0.18.1-environment.yml

Note

On Windows, you have to open up the conda environment file and delete the lines with sherpa and healpy. Those are optional dependencies that currently aren’t available on Windows.

This creates a conda environment called gammapy-0.18.1 which you can activate via:

conda activate gammapy-0.18.1

Note that you have to execute that activation command (but not the environment creation command) every time you open a new terminal window, because the default with conda is the base environment, which doesn’t have Gammapy installed.

To check your Gammapy installation, you can use this command:

gammapy info

Using other package managers

If you don’t want to use Anaconda, you can use other package managers. To do so,the following pages contain detailed information about Gammapy dependencies and propose various installation options:

Download tutorials

You can now proceed to download the Gammapy tutorial notebooks and the example datasets used there (at the moment from CTA, H.E.S.S. and Fermi-LAT). The total size to download is about 180 MB. Select the location where you want to install the datasets and proceed with the following commands:

gammapy download tutorials --release 0.18.1
cd gammapy-tutorials
export GAMMAPY_DATA=$PWD/datasets

You might want to put the definition of the $GAMMAPY_DATA environment variable in your shell profile setup file that is executed when you open a new terminal (for example $HOME/.bash_profile).

If you are not using the bash shell, handling of shell environment variables might be different, e.g. in some shells the command to use is set or something else instead of export, and also the profile setup file will be different.

On Windows, you should set the GAMMAPY_DATA environment variable in the “Environment Variables” settings dialog, as explained e.g. here

The datasets are curated and stable, the notebooks are still under development just like Gammapy itself, and thus stored in a sub-folder that contains the Gammapy version number.

If there are issues, note that you can just delete the folder any time using rm -r gammapy-tutorials and start over.

What next?

Congratulations! You are all set to start using Gammapy!

  • If you’re new to conda, Python, ipython and Jupyter, read the Getting Started guide.

  • To learn how to use Gammapy, go to Tutorials.