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 plotting libraries:

Most of the examples require these libraries to plot results.

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 python-numpy python-scipy python-numba python-matplotlib python-seaborn

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

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

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

The only drawback of this method is that it installs only the modules of the package, and not the additional examples (e.g. the datasets and scripts that were used to generate the plots found in the book).