# Installation¶

Before installing TARDIS, please check its requirements. We provide instructions for installing TARDIS using Anaconda. If you encounter problems, consult the troubleshooting section. Once you have installed TARDIS, check out running for instructions of how to perform simple TARDIS calculations.

Warning

TARDIS is currently only compatbile with Python 2.7.

Note

We strongly recommond to install TARDIS within an Anaconda environment and to always use the lastest github development version.

## Requirements¶

You can see a list of all the requirements of TARDIS in the environment definition file.

TARDIS is using astropy’s excellent installation helpers and thus uses similar instructions to astropy.

## Installing TARDIS with Anaconda¶

We highly recommend using the Anaconda python environment to install TARDIS (or any other scientific packages for that matter). Anaconda has the advantage of being an isolated environment that can be set to be the default one, but by no means will mess with your other environments. It will also work on computers where root-rights are not available. Use these instructions to install Anaconda on your machine. The next step is to create an environment for TARDIS that contains all of the necessary packages (this ensures that TARDIS requirements won’t clash with any other python installs on disc:

https://raw.githubusercontent.com/tardis-sn/tardis/master/tardis_env27.yml


To create the environment, change to the directory that you downloaded the environment definition file and run:

conda env create -f tardis_env27.yml


Then to activate this environment simply do:

source activate tardis


or the new method:

conda activate tardis


and after you are done with TARDIS you can deactivate:

source deactivate


One does not need to recreate the environment, but simply activate it every time TARDIS is used.

Since TARDIS has reached a mature state, we recommend always installing the latest development version:

pip install git+https://github.com/tardis-sn/tardis


Alternatively, you can manually clone our repository and install TARDIS by

git clone https://github.com/tardis-sn/tardis.git cd tardis python setup.py install

Manually, cloning the repository enables other options such as running the code in parallel (enabling OpenMP). In general we encourage to download the compilers from conda as we then can ensure that they work with TARDIS. Within the TARDIS conda environment do:

conda install -c conda-forge compilers


For macOS:

conda install -c conda-forge llvm-openmp


For Linux:

conda install -c conda-forge openmp


To compile TARDIS for parallel execution:

python setup.py install –with-openmp

## Installation Troubles (FAQ)¶

We highly encourage with any installation problems to try the recommended install method because this often fix problems. Here are some common problems when installing and their fixes:

Problem: While building tardis via python setup.py build you may encounter the following error:

error: tardis/montecarlo/montecarlo.c: Could not find C file tardis/montecarlo/montecarlo.c for Cython file tardis/montecarlo/montecarlo.pyx when building extension tardis.montecarlo.montecarlo. Cython must be installed to build from a git checkout.


Solution: There are several solutions to this problem. A clean checkout will help. To clean up your repository please try python setup.py clean and then git clean -dfx (WARNING will delete any non tardis file in that directory) This will often clean this problem. If it still persists:

Go into the tardis/montecarlo directory and build montecarlo.c by hand:

cython montecarlo.pyx


Then, python setup.py build should run without problems.

Problem: when trying to set up CC=gcc python setup.py develop –with-openmp the following error popped up: from tardis/_compiler.c:1: /Users/yssavo/miniconda2/envs/tardis-show2/lib/gcc/x86_64-apple-darwin13.4.0/5.2.0/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory

Solution: Run on terminal:

Solution: Install gcc8 from macports and then install with these flags: link_args = [‘-fopenmp’,’-Wl,-rpath,/opt/local/lib/gcc8/’]

Problem: While building tardis(via python 2.7) via python setup.py build you may encounter the following error:

 TypeError: super() argument 1 must be type, not None

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-wPB39p/

Solution: The cause for this problem is sphinx , or sphinx version . It can be easily solved by installing sphinx 1.5.6.

The command for the same is :

pip install sphinx==1.5.6

or

conda install sphinx==1.5.6

Then, python setup.py build install should run without problems.