Installation (Linux and Mac OS)
LIFEsim is available for installation from Github. It is compatible with Python 3.8.
Hint
Installation on Mac OS
We recommend the usage of a package manager for mac (e.g. Miniconda). Follow the installation instruction given by the respective package manager, making sure that you use the correct version of python (3.8).
Open a terminal window and activate conda by running
$ conda activate
Virtual Environment
It is highly recommended to install LIFEsim in a virtual environment. This ensures installed packages and changes made do not affect other projects on a system. The package dependencies of LIFEsim are best managed with a package manager like pip.
As a first step, virtualenv is installed with pip
$ pip install virtualenv
Then a virtual environment in the folder new_folder is created in the current directory
$ virtualenv -p python3.8 new_folder
Hint
You might need to deactivate the conda base
$ conda deactivate
To activate and deactivate your new virtual environment use the following statement respectively
$ source path_to_new_folder/new_folder/bin/activate
Check that you are using the correct python version.
$ python --version
Python 3.8.X
$ deactivate
Download from PyPI (Recommended)
First, activate the virtual environment as shown above. LIFEsim can be installed from PyPI using the pip command.
$ pip install lifesim
LIFEsim need a modified version of the package SpectRes to run. It can also be installed using pip. Run
$ pip install git+https://github.com/fdannert/SpectRes.git
Download from Github
Navigate to the directory in which you desire to place the LIFEsim repository. Then clone the repository from Github by executing
$ git clone https://github.com/fdannert/LIFEsim.git
Hint
If git is not installed on your system run
$ sudo apt install git
The dependencies required by LIFEsim can be installed with
$ pip install -r LIFEsim/requirements.txt
To upgrade already installed dependencies to LIFEsim requirements run
$ pip install --upgrade -r LIFEsim/requirements.txt
Important
LIFEsim need a modified version of the package SpectRes to run. Please install it via the following procedure.
First, make sure that you are in the directory where you want to install SpectRes. Then run
$ git clone https://github.com/fdannert/SpectRes.git
The last step is point the Python install of your virtual environment to LIFEsim and SpectRes. Please do so by running
$ echo "export PYTHONPATH='$PYTHONPATH:/path_to_LIFEsim/LIFEsim/:/path_to_SpectRes/SpectRes/'" >> path_to_new_folder/new_folder/bin/activate
Testing the Installation
To test the installation, open a new console and activate the virtual environment as above. Then open Python and import LIFEsim with
$ python
>>> import lifesim
If the import statement executes, the installation has been successful. As an extra test run
>>> lifesim.util.constants.c
299792000.0
This should return the speed of light in [m s \(^{-1}\) ].
Hint
If the import lifesim command fails, the reason is likely that the the PYTHONPATH
is not set correctly. To check for this please run in Python (started with the virtual
environment active as above)
>>> import sys
>>> sys.path
If the path to LIFEsim '/path_to_LIFEsim/LIFEsim/' is not returned in the results, please
open the file path_to_new_folder/new_folder/bin/activate with a text editor of your choice.
Then make sure that the last line of the file reads
export PYTHONPATH=':/path_to_LIFEsim/LIFEsim/'
The same test can be performed if SpectRes does not import.