DRP installation
The MEGARA pipeline is a Python package, for Python 3.10 or greater.
The easiest method of installing megaradrp is using pip inside a
virtual environment. You can install official relares or the development
version. All the commands in the following sections, starting with $ are
to be run under bash shell.
Install with pip
A virtual environment creates isolated Python installations, with (potentially) different package versions. We will use the venv package (a module in the standard library) here, although the virtualenv package can also be used.
The steps to run MEGARA DRP in a virtual environment are:
Create a virtual environment
A virtual environment will have a name and a path. In order to create a virtual environment called e.g. megara using venv:
With virtualenv:
The directory /path/to/megara represents the location of the environment.
It can be any valid directory path.
If only a name is given (for example megara), it will be created in the
working directory (notice that
virtual environments shouldn’t be moved after creation).
Activate the environment
After creating the environment, the directory /path/to/megara
contains a Python tree. One of the directories is
/path/to/megara/bin, which contains a script called activate. To
activate the environment, we source (a bash shell command) this script
file:
which yields a different system prompt to the user:
Now, the name of the environment appears before the standard prompt. We can use the environment only on those consoles / terminals where we have previously activated it.
Install megaradrp with pip
After the activation, we can install megaradrp with pip. This is the standard Python tool for package management. It will download the package and its dependencies, unpack everything and compile when needed.
What follows is a sample of the output:
(megara) $ pip install megaradrp
If you want to guarantee that megaradrp is completely reinstalled (even if it is already installed), downloading it again, without using any cached wheel or source distribution, you can use:
(megara) $ pip install --no-cache-dir --force-reinstall megaradrp
Test the installation
Now we can test the installation by running the numina command:
(megara) $ numina --version
(megara) $ numina show-instruments
The particular output of the command may change, but Instrument: MEGARA text
should always appear.
Update within the environment
In order to update the MEGARA DRP to the latest stable release, the user should execute:
(megara) $ pip install -U megaradrp
Deactivate the environment
To exit the environment is enough to exit the terminal or run the command deactivate.
Install in a conda environment
The packages of megaradrp and numina in the conda-forge channel are no longer updated: they are older versions, and some dependencies of numina are not in conda-forge. If you use conda (for example with miniforge or miniconda), create the environment with conda and install megaradrp in it with pip, from PyPI.
Create and activate a conda environment
With conda, environments are created in a centralised manner (under
directory ./envs in your conda tree), we do not pass the path to the
environment:
Install megaradrp with pip
Inside the conda environment, install megaradrp with pip, as in the virtual environment:
(megara) $ pip install megaradrp
Avoid installing or updating afterwards with conda, in that environment, the packages that pip has installed. The installation can be tested as described above. To update the MEGARA DRP:
(megara) $ pip install -U megaradrp
To exit the environment, run conda deactivate. The environment (and all
its content) can be removed, if needed, with:
Development version
For those of you interested in installing the development version, please consult the instructions at the readthedocs.org webpage at https://megaradrp.readthedocs.io/en/latest/installation.html. The use of the development version is recommended to have access to the latest DRP improvements.