ELFI requires Python 3.9 or greater (see below how to install). To install ELFI, simply type in your terminal:

pip install elfi

In some OS you may have to first install numpy with pip install numpy. If you don’t have pip installed, this Python installation guide can guide you through the process.

Installing Python 3.9

If you are new to Python, perhaps the simplest way to install it is with Anaconda that manages different Python versions. After installing Anaconda, you can create a Python 3.9. environment with ELFI:

conda create -n elfi python=3.9 numpy
source activate elfi
pip install elfi

Optional dependencies

We recommend to install:

  • graphviz for drawing graphical models (pip install graphviz requires Graphviz binaries).

Potential problems with installation

ELFI depends on several other Python packages, which have their own dependencies. Resolving these may sometimes go wrong:

  • If you receive an error about missing numpy, please install it first.

  • If you receive an error about yaml.load, install pyyaml.

  • On OS X with Anaconda virtual environment say conda install and then use pythonw instead of python.

  • Note that ELFI requires Python 3.9 or greater

  • In some environments pip refers to Python 2.x, and you have to use pip3 to use the Python 3.x version

  • Make sure your Python installation meets the versions listed in requirements.

Developer installation from sources

The sources for ELFI can be downloaded from the Github repo.

You can either clone the public repository:

git clone

Or download the development tarball:

curl -OL

Note that for development it is recommended to base your work on the dev branch instead of master.

Once you have a copy of the source, go to the folder and type:

pip install -e .

This will install ELFI along with its default requirements. Note that the dot in the end means the current folder.

Docker container

A simple Dockerfile with Jupyter support is also provided. This is especially suitable for running tests. Please see Docker documentation for details.

git clone --depth 1
cd elfi
make docker-build  # builds the image with requirements for dev
make docker  # runs a container with live elfi directory

To open a Jupyter notebook, run

jupyter notebook --ip --no-browser --allow-root

within the container and then on host open the page localhost:8888.