Quick Start

Running Online

Jupyter Notebook enables you to run Python code in your browser. lifelib comes with some Jupyter notebooks, and the quickest way to try lifelib is to run the notebooks online. Go to Jupyter Notebooks page and click one of the banner links. The link will take you to a web page where the selected notebook starts loading. Once the notebook loads, select Cell menu, and then select Run All to run & build models and get results and draw graphs. To run the notebooks locally on your computer, refer to running-notebooks section.


Set up Python Environment

To run lifelib models locally on your PC, you need to have a Python environment. This guide assumes users are on Windows platform, but lifelib runs on both Windows and Linux, and probably on Mac as well although it’s not tested on Mac.

If you don’t have Python environment set up on your computer, downlowd and install Anaconda distribution. Anaconda is a bundle of Python, its major packages and IDEs including packages required or optionally used by for lifelib, such as openpyxl, Pandas, Spyder, and provides a Python environment out-of-the-box, just by installing it with few clicks.

lifelib requires Python 3.6 or newer. If you already have Anaconda installed, make sure the Python version is 3.6 or newer. lifelib does not work with Python 2.7.

Microsoft Excel is not required. You would only need Excel or its alternatives if you want to edit input data files.


Although we assume we use Anaconda and Spyder in this guide, you should be completely fine with using lifelib with other distributions or IDEs, as long as all the relevant packages are installed and configured.

Install lifelib

lifelib is avalable on PyPI - the Python Package Index. To install lifelib, use pip command from an Anaconda command prompt. Go to Windows menu and start Anaconda Prompt inside Anaconda3 submenu to bring up a command prompt.


Then in the Anaconda Prompt, execute the following command:

> pip install lifelib

When you update your existing installation to the newest release, use -U option:

> pip install -U lifelib

The command also installs modelx package, because lifelib depends on it. All the other required or optionally used packages are included in Anaconda, so no need to install them separately.


(For advanced users) To install the latest development version instead of the released version, clone the lifelib repository and modelx repository on github, and install them from the cloned repos in editable mode.

Creating a Project

lifelib is essentially a collections of folders called projects, containing source and data files to build models. You use lifelib by copying a project from lifelib package to your own path.

A command lifelib-create helps you create a new project folder by copying a template project from within the lifelib package to your desired folder path.

For example, to create a project folder named mylife under the path C:\Users\fumito by copying lifelib’s default project template simplelife, type the following command on the Anaconda prompt:

> lifelib-create --template simplelife C:\Users\fumito\mylife

Alternatively, since simplelife is the default template, you can get away with –template option like this:

> lifelib-create C:\Users\fumito\mylife

Check that the folder is created and populated with files copied from lifelib’s default project.

Running Notebooks

Jupyter notebooks on Jupyter Notebooks page are also included in lifelib projects, and can be executed on your local computer by running Jupyter Notebook locally. For example, if you create a project folder named myifrs17sim from the project template ifrs17sim, you can go to the folder by cd command and launch Jupyter Notebook:

> cd myifrs17sim

> jupyter notebook

The command above opens a new tab in your web browser, and Jupyter Notebook session starts in the tab.


files with ipynb extension are Jupyter notebooks. By double-clicking one, it opens in another tab, and you’ll see the same page as you see it online.

Using Spyder plugin

Spyder is a popular scientific Python IDE, and it’s bundled in with Anaconda by default. Spyder plugin for modelx adds widgets to Spyder, letting users to develop models with modelx more intuitively in Spyder. Go on to Using Spyder plugin page for more details.