Installation Instructions
HyperGas can be installed through conda-forge (using conda), PyPI (using pip), or directly from source (using pip with Git). The instructions below cover installing stable releases of HyperGas. For guidance on installing the development or unstable version, see Developer’s Guide.
Conda-based Installation
You can set up HyperGas in a conda environment by pulling the package from the conda-forge channel. If you don’t already have conda installed, the simplest option is to install Miniforge, which provides a lightweight base system.
In a new conda environment
We suggest setting up a dedicated environment for working with HyperGas. Creating an environment with HyperGas (and any other packages you want) right away is typically quicker than creating the environment first and installing packages afterward.
Using Miniforge (recommended)
Miniforge is the quickest way to install HyperGas dependencies:
Create the environment using
mamba(the fast package manager forconda): You can create a fresh environment and install HyperGas in a single step by running:$ mamba create -c conda-forge -n hypergas_env python hypergas
After the environment is created, make sure to activate it so that any future Python or conda commands use the correct setup:
$ mamba activate hypergas_env
Hint
If you want to activate the installed environment by default,
you can add the activating line to your ~/.bashrc.
Using Anaconda or Miniconda
The examples below use -c conda-forge to ensure that all packages come specifically from the conda-forge repository.
If you prefer to make conda-forge your default source, you can run:
$ conda config --add channels conda-forge
Default method (slower)
$ conda create -c conda-forge -n hypergas_env python hypergas
$ conda activate hypergas_env
Using mamba (faster)
$ conda install -n base mamba
$ (optional: initialize shell) mamba shell hook --shell bash
$ mamba create -c conda-forge -n hypergas_env python hypergas
$ conda activate hypergas_env
Note
If your conda version is older than 23.10, we recommend updating it
to take advantage of the faster mamba feature:
$ conda update -n base conda
In an existing environment
If you already have a conda environment active and want to add HyperGas to it, you can install it with:
$ mamba install -c conda-forge hypergas
or
$ conda install -c conda-forge hypergas
Pip-based Installation
HyperGas can be installed directly from the Python Package Index (PyPI). If you’d like to set up an isolated environment for working with HyperGas, you can use virtualenv.
To install the core HyperGas package along with its essential Python dependencies, run:
$ pip install hypergas
Note 1: Dependencies Requiring Manual Installation
Note
If you installed HyperGas by mamba or conda, all dependencies have been installed by default. For PyPI users, you need to install two dependencies (tobac and EnPT) manually due to installation constraints.
The tobac package is not avaliable on PyPI. Please check the tobac documentation for installation instructions. The EnPT package is not installed by default via PyPI, because GDAL can cause installation errors. Please check the EnPT documentation for installation instructions.
Note 2: Update Satpy
Because the hyperspectral readers are not yet merged into the official Satpy package, you will need to install the development version of Satpy:
$ pip install git+https://github.com/zxdawn/satpy.git@hyper
Note 3: Fix Spectral Python (SPy)
To prevent the np.linalg.inv singular matrix error,
you’ll need to make a small modification in the Spectral Python package.
Locate your Spectral Python installation. You can find its path by running the following in Python:
import spectral
print(spectral.__file__)
Open the file
spectral/algorithms/algorithms.pyand replace the line around 750:
np.linalg.inv(self._cov)
with:
np.linalg.pinv(self._cov)
For more details on this issue, refer to the PR on GitHub.