Skip to main content

Forward-time population genetic simulation in Python

Project description

This is the README for fwdpy11, which is a Python package for forward-time population genetic simulation. It uses fwdpp as its C++ back-end.

Build status




Python code style:


  • Pickle-able population objects
  • Parallel computation via multiprocessing or concurrent.futures.
  • Custom temporal samplers to analyze populations during a simulation may be written in pure Python.
  • Flexible interface for simulating models with multiple populations.


The manual can be found here.


The following must be present on your system:

  • GSL. This is a C library. It is available via conda. fwdpy11 requires version 2.3 or greater.
  • cmake. This should be installed by conda or your favorite package manager.

fwdpy11 also uses fwdpp, which is included as a submodule.


GPLv3 or later (See COPYING)

Supported Python version

fwdpy11 is written for Python 3. We will not modify the package to be compatible with Python 2.7.


Building from the git repository:

git submodule init
git submodule update
python build_ext -i
python -m pytest tests

Using pip on macOS and Linux (or pip3 as appropriate for your system):

pip install --upgrade fwdpy11

It is possible that the cmake macros to detect the GSL can fail to detect the correct version. Issues like this are a basic weakness of cmake. I’ve seen this in conda environments, where the macro prefers the system version over the newer version in the environment. To “fix” this, give it a hint:

GSL_ROOT_DIR=/path/to/gsl python3 build_ext -i


On Apple’s macOS, we strongly encourage that you use conda with their compiler packages:

conda install clang_osx-64 clangxx_osx-64

Installing these packages will mean that you can get away from the relatively old versions of these compilers that ship with Xcode. However, you do need to add the following flag when building the package:

On macOS versions prior to “Mojave”:

CONDA_BUILD_SYSROOT=/ python3 build_ext -i

For later versions, you may omit the environment variable prefix.

Do the same for a pip install from the source directory.


We have heard positive reports of using fwdpy11 on Windows 10 with the Ubuntu subsystem installed. For such a system, you may use a Linux conda installer and then install fwdpy11 via bioconda.

The developers do not have access to this platform, but we are keen to hear of any issues.


We use the GitHub “release” mechanism to make stable versions available. However, GitHub releases to not include the sub-modules, meaning that the releases themselves cannot be used for installation. (A related irony is that the Zenodo DOI for the releases are somewhat meaningless.)

To install a specific release:

  1. Use pip (see above). This is the recommended approach if you do not use conda.
  2. Install from bioconda. This is the recommended approach.
  3. Clone the repo, checkout the release, and update submodules:
git clone
cd fwdpy11
git submodule init
git submodule update

The latter method is probably the least appealing.

We have a strict policy of putting releases on PyPi and bioconda. If there is a release on PyPi but not on bioconda, then that is because we identified a bug and pushed a new release before the bioconda build happened. It happens. That’s life.


fwdpy11 is available through bioconda for Linux and for macOS:

conda install -c bioconda fwdpy11


Please read the bioconda documentation! The order of channels matters.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for fwdpy11, version 0.15.2
Filename, size File type Python version Upload date Hashes
Filename, size fwdpy11-0.15.2-cp37-cp37m-macosx_10_15_x86_64.whl (2.2 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size fwdpy11-0.15.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.6 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size fwdpy11-0.15.2-cp38-cp38-macosx_10_15_x86_64.whl (2.3 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size fwdpy11-0.15.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.6 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size fwdpy11-0.15.2-cp39-cp39-macosx_10_15_x86_64.whl (2.3 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size fwdpy11-0.15.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.6 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size fwdpy11-0.15.2.tar.gz (1.2 MB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page