Using *conda to provide python dependencies for esoreflex

The following is a step-by-step guide to setting up a conda environment for esoreflex.


The following assumes that esoreflex and the pipelines you want are already installed. See the Pipeline pages at http://eso.org/sci/software/pipelines/index.html  if you need help with that.


Currently ESO provides binary packages for: 

  • Fedora (28 to 32) 
  • CentOS 7 
  • Scientific Linux 7 
  • macOS (10.14 to 10.15 and 11) 


Note that for other macOS versions, the MacPorts repository can still be used, but the packages will be built locally on your machine, rather than directly installing the binary packages provided by the ESO package repositories.


If your operating system + version/distribution combination is one of those currently supported by ESO's package repositories then we strongly recommend you use the appropriate package manager (RPM for Linux and MacPorts for macOS) to install the pipelines, esoreflex and workflows. Using the package managers will automatically install all other required software dependencies, including python and the following should not (in most cases) be necessary.



Before starting, please note that lines formatted like the following:


ls


mean that you should execute the command (preferably by copy/paste) in a terminal. In general it is safest to copy them line by line, but note some commands are broken onto multiple lines by a '\' character at the end of the line, in this case copy/paste all sequential lines ending in '\' plus the next line with no '\' at the end of the line.


The following assumes that your shell is bash, so if you do not use bash shell, or if you are not sure which shell you use type


bash


now...


If you don't already have a *conda installation, we suggest installing miniconda.


Under Linux, miniconda is available via RPM/apt package directly from conda.io (recommended) see:


  https://docs.conda.io/projects/conda/en/latest/user-guide/install/rpm-debian.html


or via third-party sources (e.g. EPEL).


for macOS it is possible to install miniconda as follows:


cd /tmp

MoL=$(uname -s | sed -e 's/Darwin/MacOSX/')

curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-${MoL}-x86_64.sh

chmod u+x ./Miniconda3-latest-${MoL}-x86_64.sh

./Miniconda3-latest-${MoL}-x86_64.sh


Note, to avoid setting the *conda environment as your default environment, at the following prompt near the end of the installation:


Do you wish the installer to initialize Miniconda3

by running conda init? [yes|no]

[yes] >>>


Answer no.


Now assuming *conda is already installed, activate if not already activated:


eval "$(conda shell.bash hook)"


Note: you may need to specify the full path to conda if it is not in your PATH, e.g. for the above Miniconda installation, ${HOME}/miniconda3/bin/conda.


Now with conda activated and esoreflex already installed, assuming that the “esoreflex” command can be found in the PATH then do:


ESOREFLEX_INSTALL_DIR=$(dirname $(dirname "$(which esoreflex)"))


Create a *conda esoreflex environment -- wxpython is no longer available from the default repos, so we suggest conda-forge:


ESOREFLEX_ENV_NAME=esoreflex

conda create -n ${ESOREFLEX_ENV_NAME} -c conda-forge python=3.10 "matplotlib>=3.5.3,<3.6" "wxpython>=4.1.1,<4.2" astropy


Configure esoreflex to use the esoreflex *conda environment


conda activate ${ESOREFLEX_ENV_NAME}

Please follow the instructions below, as appropriate for your operating system/distribution.

Choose your platform:



astroscrappy & PyCosmic for giraffe:

conda install -y scipy

pip install https://files.pythonhosted.org/packages/source/a/astroscrappy/astroscrappy-1.0.8.tar.gz

curl -O ftp://ftp.eso.org/pub/usg/PyCosmic/PyCosmic-0.5.3.tar.gz

pip install PyCosmic-0.5.3.tar.gz

rm PyCosmic-0.5.3.tar.gz


scikit-learn for muse-zap:

conda install scikit-learn


Deactivate the conda esoreflex environment:

conda deactivate


Deactivate the conda base environment (optional):

conda deactivate


Note, once you’ve performed the above procedure, you do not need to activate the esoreflex conda or base conda environment to use esoreflex, you can simply execute from any environment.


esoreflex


Instrument selector