Skip to content
Switch branches/tags
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Python for Population Genomics (PyPop)

PyPop is a framework for processing genotype and allele data and running population genetic analyses.


1. Install OS-specific development environment


  1. install developer command-line tools: (includes git, gcc)
  2. Visit and follow the instructions there to install the latest version of MacPorts for your version of MacOS X.
  3. Set environment variables to use macports version of Python and other packages, packages add the following to ~/.bash_profile
export PATH=/opt/local/bin:$PATH
export LIBRARY_PATH=/opt/local/lib/:$LIBRARY_PATH
export CPATH=/opt/local/include:$CPATH
  1. Rerun your bash shell login in order to make these new exports active in your environment. At the command line type:
exec bash -login

2. Clone the repository:

git clone

3. Install dependencies


Install the MacPorts packages

  sudo port install swig-python gsl py27-numpy py-libxml2 py27-libxslt py-setuptools py27-pip

Set MacPorts to use the just-installed 2.7 MacPorts version of Python and pip:

  sudo port select --set python python27
  sudo port select --set pip pip27

Check that the MacPorts version of Python is active by typing: which python, if it is working correctly you should see the following:


Linux (Fedora/Centos/RHEL):

Need at least Fedora 25 for the appropriate dependencies:

  sudo dnf install swig gsl-devel python2-numpy python-libxml2 libxslt-python python-setuptools python-pip

See for instructions on containerizing the install on a Centos/RHEL release.

Linux (Ubuntu)

Install the following packages

  sudo apt install git libgsl-dev python-numpy python-libxml2 python-libxslt1 python-setuptools python-pip

The swig package in recent Ubuntu releases has bugs, you will need to compile the most recent from source, see also for details.

4. Build

./ build


These are examples of how to use PyPop. Specify the --help option to see an explanation of the options available.

Run a minimal dataset:

./bin/ -c  tests/data/minimal.ini tests/data/USAFEL-UchiTelle-small.pop

This will generate the following two files, an XML output file and a plain text version:


Running test suite

  ./ test

If you run into errors, file a bug (as per Support, below), include the output of py.test run in verbose mode and capturing the output

  py.test -s -v

(See for more details on installing or running py.test outside the context of setuptools.)


Please submit bug reports and feature requests

Bug reporting

When reporting bugs, especially during installation, please run the following and include the output:

echo $CPATH
echo $PATH
which python

If you are running on MacOS please also run and include the output of:

port installed


The code for PyPop is at

Copyright and License

PyPop is Copyright (C) 2003-2015. The Regents of the University of California (Regents)

PyPop is distributed under the terms of GPLv2