Python 2 vs Python 3

Short version: particles only supports Python 3.

Long version: initially, particles supported both Python 2 and Python 3. However, Python 2 has been deprecated, and supporting it has become troublesome. The last version to support it has been turned into a release; you may find in the releases section of the github page (first release, April 15, 2020).


The short version: install The Anaconda distribution to get all the scientific computing libraries you may ever need in one go.

The long version: particles requires the following libraries:

In addition, it is strongly recommended to install the following libraries (optional [extra] dependencies):

Most of the scripts require the first two libraries to plot the results; a few of them also requires pandas or statsmodels.

Again, the easiest way to install all these libraries in one go is to simply install the Anaconda distribution. Manual installation is of course also possible; e.g. on Ubuntu/Debian:

sudo apt install python3-numpy python3-scipy python3-numba python3-joblib python3-sklearn

However, in the maintainer’s experience, conda is usually less hassle, runs faster (because it install a more efficient version of low-level libraries such as BLAS) and provides more recent versions.

Local installation, organisation of the package

You are strongly recommended to install the package locally (in a folder in your home directory). The installation instructions in the following sections explains how to do it.

The reason why it is better to do a local install is that you will have easier access to the scripts in the package. In particular:

  • Folder book contains all the scripts that were used to perform the experiments and generate the plots in the book. Each sub-folder corresponds to a different chapter.

  • Folder papers contains scripts that reproduce some of the experiments of relevant papers. Each sub-folder corresponds to a different paper, and contains a which gives the reference of the paper.

The rest of the package is organised in a completely standard manner (modules are in folder particles, documentation is in docs, etc.).

Installation: alternative method

The package is also available on PyPI (the Python package index), so you may install it by running pip. On a Linux machine:

pip install --user particles[extra]

Option --user lets you install the package in your home directory, rather than globally for all users.

The main drawback of this method is that it installs only the modules of the package, and not the scripts found in folders book and papers.