Registry / data / msprime

msprime

JSON →
library1.4.2pypypi✓ verified 79d ago

msprime is a fast, scalable Python library for simulating genealogical trees and genomic sequence data under population genetic models using the coalescent with recombination. Current version 1.4.1 supports Python >=3.11. Released under GPL, maintained by the TSKIT team with regular updates.

pip install msprime
INSTALL
IMPORT
SIG · MSPRIME
M
msprime
datapythonv1.4.2
Install
5.4s avg
Import
862ms
Disk
110MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 5.4s · import 0.862s · 116MB
110MB installed
● package 110MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

simulate
from msprime import simulate
import msprime as ms
AncestryModel
from msprime import AncestryModel
Demography
from msprime import Demography

Simulate a basic coalescent tree sequence with recombination.

import msprime # Simulate a coalescent sample of 10 chromosomes recombination_rate = 1e-8 sequence_length = 1e4 ts = msprime.simulate( sample_size=10, recombination_rate=recombination_rate, length=sequence_length, random_seed=42 ) print(ts.num_trees, ts.num_samples)
msp --version
Debug
Known issues
breakingIn msprime 1.0, the API was overhauled: `msprime.simulate()` replaces `msprime.simulate()` from older versions (no change in name but parameter changes). The `Ne` parameter is no longer accepted; use `population_size`.
fix
Replace `Ne=X` with `population_size=X`. Ensure you use msprime 1.x imports.
affects: >=0.7.0, <1.0
deprecated`msprime.simulate()` with mutation_rate parameter is deprecated in favor of `msprime.mutate()` applied to a tree sequence.
fix
Run `ts = msprime.simulate(...)` then `ts = msprime.mutate(ts, rate=1e-8)`. See docs for details.
affects: >=1.0
gotchaSetting `random_seed` to the same value will produce identical results. For parallel simulations, ensure each process uses a unique seed.
fix
Use different seeds (e.g., derived from process ID) when running parallel simulations.
affects: all
gotchaWhen using `msprime.simulate()` with multiple populations, the `sample_size` parameter expects a list of sample sizes per population, not the total. Incorrect usage leads to confusing errors.
fix
Pass a list: `sample_size=[5,5]` for two populations. Do not pass total 10.
affects: >=1.0
breakingSupport for Python 3.8 and 3.9 dropped in msprime 1.4.0. Requires Python >=3.11 as of 1.4.1.
fix
Upgrade Python to 3.11 or later.
affects: >=1.4.0
Upgrade
Version history
1.4.2latest on PyPI · released May 20, 2026
Audit
Dependencies
numpyrequiredRequired for numerical operations.
tskitrequiredRequired for tree sequence data structures and analysis.
Agent activity
4 hits · last 30 days
node
4
Resources
msprime — pip install msprime · libregistry