Installation

Tips for Python beginners

Using anaconda is strongly recommended. Simply follow the instructions here for your operating system (Linux, Mac, Windows, ...). If you already feel confident with virtual environments, consider setting up a new one for allesfitter (more infos here). Otherwise, don't worry, you're good to go with the base anaconda, too.

Having installed anaconda, open a new terminal window and make sure you are in the right anaconda environment (it will say "base" or your virtual environment name at the start of the line). 

If you are on a Mac, make sure to switch to a bash terminal. You can do this for this session only by executing "bash" or do it permanently by executing "chsh -s /bin/bash". 

Now execute "which conda" to make sure it returns the correct path. Something like "/Users/janeeyre/opt/anaconda3/bin/conda" if you use the base anaconda.

Then execute "which pip" to make sure it returns the correct path. Something like "/Users/janeeyre/opt/anaconda3/bin/pip" if you use the base anaconda.

Some packages come pre-installed with anaconda. You can check if you have them by opening a Terminal window and executing the generic "conda list" (shows you everything) or the specific "conda list xyz"(xyz being the respective package name below). 

You can install missing packages via conda:

conda install xyz

And more specific packages via pip:

pip install xyz

Installing allesfitter

pip install allesfitter

Installing requirements

Standard packages (pre-installed or install via conda):

Special packages (install via pip):

Even more special packages (install via pip, optional):

Footnotes

Trouble with Fortran and C compilers for ellc? 

The package ellc needs you to have a Fortran compiler installed. Try using `pip install ellc' at first, as you would usually do. If it fails and complains about compilers, follow the steps below.


On Mac (with Intel chips) and Linux 


On Mac (with M1/M2 chips)

Note: Anaconda does not yet fully support the new M1 cips. As an alternative, miniforge is the earliest available conda installer that supports the new M1 chips. Its default channel, conda-forge, provides the latest packages for various architectures, including ARM64. This means that it can provide more streamlined support for M1 chips than anaconda currently can. All credit for this solution goes to Xian-Yu Wang, see here


On Windows

There are several steps to follow before running allesfitter on Windows. You can use the following procedure to run allesfitter on Windows. All credit for this solution goes to Xian-Yu Wang.

# Open PowerShell as an administrator

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

# Install gfortran to compile ellc

choco install mingw cmake

# Install wget to download what you want

choco install wget

# Install m2-base to use common Linux commands like clear, ls -la, grep, and so on

conda install m2-base


# Open Conda prompt

conda create -n allesfitter python

pip install numpy matplotlib seaborn scipy astropy statsmodels emcee corner tqdm dynesty celerite h5py rebound

pip install ellc

pip install allesfitter

# Open Conda prompt

# Download allesiffter

git clone https://github.com/MNGuenther/allesfitter.git

# Enter the folder named `03_transits_with_GPs`

cd allesfitter\allesfitter\tutorials\03_transits_with_GPs

# Run the test

python run.py

Replace the following code in allesfitter (https://github.com/MNGuenther/allesfitter/search?q=fork):

multiprocessing.set_start_method('fork', force=True)

with:

if os.name == 'posix':

   multiprocessing.set_start_method('fork', force=True)

else:

   multiprocessing.set_start_method('spawn', force=True)

Add this function to mcmc.py:

def init_mcmc(datadir):

    config.init(datadir)

Change the following code in mcmc.py:

with closing(Pool(processes=(config.BASEMENT.settings['multiprocess_cores']))) as pool:

to:

with closing(Pool(processes=(config.BASEMENT.settings['multiprocess_cores']), initializer=init_mcmc, initargs=(datadir,))) as pool: