Installation

Warning

Fermitools 2.1.xx and fermipy 1.1.xx are still undergoing testing. Please refer to fermipy 1.0.1 and fermitools 2.0.8 for science analysis. Report any issues on github.

Note

From version 1.1.1 fermipy is only compatible with fermitools version 2.1 or later, and with python version 3.9 or higher. If you are using an earlier version, you will need to download and install the latest version from the FSSC.

These instructions will install fermipy as well as its dependecies.

Conda-based installation

The recommended way to install fermipy and the fermitools by using mamba.

You can use conda instead but it can take longer to solve the requested environment.

$ mamba create --name fermipy -c conda-forge -c fermi -c fermi/label/dev python=3.9 "fermitools>=2.1.0" healpy gammapy
$ mamba activate fermipy
$ pip install fermipy

Installing from source

If you want to install fermipy from source you can use the environment.yml file to install the dependecies. Installing from source can be useful if you want to make your own modifications to the fermipy source code. Note that non-developers are recommended to install a tagged release of fermipy following the Conda-based installation instructions above.

To set up a conda environment with the dependencies

$ git clone https://github.com/fermiPy/fermipy.git
$ cd fermipy
$ mamba create --name fermipy -f environment.yml

To install the latest commit in the master branch run setup.py install from the root directory:

# Install the latest commit
$ git checkout master
$ python setup.py install

A useful option if you are doing active code development is to install your working copy of the package. This will create an installation in your python distribution that is linked to the copy of the code in your local repository. This allows you to run with any local modifications without having to reinstall the package each time you make a change. To install your working copy of fermipy run with the develop argument:

# Install a link to your source code installation
$ python setup.py develop

You can later remove the link to your working copy by running the same command with the --uninstall flag:

# Install a link to your source code installation
$ python setup.py develop --uninstall

Specific release tags can be installed by running git checkout before running the installation command:

# Checkout a specific release tag
$ git checkout X.X.X
$ python setup.py install

To see the list of available release tags run git tag.

The diffuse emission models

Starting with fermipy version 0.19.0, we are using the diffuse and istoropic emission model from the fermitools-data package rather than including them in fermipy. However, for working on older analyses created with earlier version of fermipy you can set the FERMI_DIFFUSE_DIR environmental variable to point at a directory that include the version of the models that you wish to use.

Upgrading

By default installing fermipy with pip or conda will get the latest tagged released available on the PyPi package respository. You can check your currently installed version of fermipy with pip show:

$ pip show fermipy

or conda info:

$ conda info fermipy

To upgrade your fermipy installation to the latest version run the pip installation command with --upgrade --no-deps (remember to also include the --user option if you’re running at SLAC):

$ pip install fermipy --upgrade --no-deps
Collecting fermipy
Installing collected packages: fermipy
  Found existing installation: fermipy 0.6.6
    Uninstalling fermipy-0.6.6:
      Successfully uninstalled fermipy-0.6.6
Successfully installed fermipy-0.6.7

If you installed fermipy with conda the equivalent command is:

$ conda update fermipy