Installation#

Creation of a conda environment#

We strongly recommend using a dedicated conda environment to avoid any potential conflict with other tools. You can learn more about conda here .

(For all users)

You can create your environment as:

$ conda create -n env_formosa python=3.11
$ conda activate env_formosa

(For macOS users)

To install and use our package in macOS with an M1 chip, a few extra steps are required. To use PyMultiNest to paralelize the processes, make sure you are building your conda environment under an OSX-ARM64 architecture. You can learn more here .

$ CONDA_SUBDIR=osx-arm64 conda create -n env_formosa python=3.11 numpy -c conda-forge
$ conda activate env_formosa
$ conda config --env --set subdir osx-arm64

A. Installation though PyPI#

PyPI is the pip package manager, which will automatically install for you almost all the required dependencies in your environment. To install the latest version, run:

$ pip install ForMoSA

A few more packages need to be installed with conda install:

$ conda install dask
$ conda install netCDF4
$ conda install bottleneck

B. Installation though GitHub#

ForMoSA can be cloned from the main branch from our GitHub repository . To clone the latest version, run:

$ cd /YOUR_PATH/formosa_desk/
$ git clone https://github.com/exoAtmospheres/ForMoSA.git

Be sure to add the path of ForMoSA to your $PYTHONPATH by adding the following line into your .bashrc.

export PYTHONPATH="/YOUR_PATH/formosa_desk/ForMoSA:$PYTHONPATH"

Install the following packages in your environment with pip install:

$ pip install numpy==1.26.4
$ pip install matplotlib
$ pip install corner
$ pip install astropy
$ pip install scipy
$ pip install scikit-learn
$ pip install configobj
$ pip install extinction
$ pip install nestle
$ pip install ultranest
$ pip install PyAstronomy
$ pip install spectres
$ pip install pyyaml
$ pip install importlib-metadata==4.13.0
$ pip install xarray==2023.10.1
$ pip install rich
$ pip install tqdm
$ pip install astroquery

Install the following packages in your environment with conda install:

$ conda install dask
$ conda install netCDF4
$ conda install bottleneck

PyMultiNest users#

If you want to use Pymultinest to run your inversion, follow the installation instructions from PyMultinest, detailed below.

First, you need to clone PyMultinest from GitHub and install it.

$ cd /YOUR_PATH/formosa_desk/
$ git clone https://github.com/JohannesBuchner/PyMultiNest/
$ cd PyMultiNest
$ python setup.py install

Second, you need to corroborate that your system has a C++ and a Fortran interpreter. If you need to install brew, follow these instructions.

$ brew install cmake
$ brew install gcc
$ brew install open-mpi

Next, in your ForMoSA environment, install mpi4pi as:

$ pip install mpi4py

Then, install MultiNest by cloning the GitHub repository and building it. Make sure you empty the build folder if you run this step more than once.

$ cd ~/YOUR_PATH/formosa_desk/
$ git clone https://github.com/JohannesBuchner/MultiNest
$ cd MultiNest/build
$ cmake ..
$ make

Note

An error can occur during the cmake .. asking you to launch cmake .. -DCMAKE_POLICY_VERSION_MINIMUM=3.5 instead

Finally, copy the files that were generated by building MultiNest onto your conda environment by doing:

$ cp -v /YOUR_PATH/MultiNest/lib/* /YOUR_PATH/opt/anaconda3/envs/env_formosa/lib/

torch users#

Torch is used for the emulators. If you wish to simply use it on CPU, you can do:

$ conda install torch torchvision torchaudio torchnmf

Otherwise, if you wish to use torch on GPU, you will need to have the right version on CUDA install on your device. Please follow the installation instructions from PyTorch.