Installation#
Python 3.9 or newer is required for tsinfer. Any Unix-like platform should
work (tsinfer is tested on Linux, OS X, and Windows).
Binary packages#
The most reliable way to install tsinfer is to install the binary conda package:
e.g.:
$ conda install tsinfer -c conda-forge
you can then import tsinfer in python or use the tsinfer executable directly:
$ tsinfer --help
Installing from source#
It is also possible to install from source via pip (although see the issues below):
$ python -m pip install tsinfer –user
which will install tsinfer to the Python installation corresponding to your
python executable. All requirements should be installed automatically.
To run the command line interface to tsinfer you can then use:
$ python -m tsinfer --help
If your PATH is set up to point at the corresponding bin directory
you can also use the tsinfer executable directly:
$ tsinfer --help
You may wish to install into a virtual environment first using venv:
$ python -m venv tsinfer-venv
$ source tsinfer-venv/bin/activate
(tsinfer-venv) $ python -m pip install tsinfer
(tsinfer-venv) $ tsinfer --help
Potential issues#
One of the dependencies of
tsinfer, numcodecs, is compiled to use AVX2 instructions (where available) when installed using pip. This can lead to issues whennumcodecsis compiled on a machine that supports AVX2 and subsequently run on older machines that do not. To resolve this,numcodecshas aDISABLE_NUMCODECS_AVX2variable which can be turned on before callingpip install, see these instructions for details.There can be problems compiling from source using the default compilers under Mac OS (see tskit-dev/tsinfer#376). The current workaround is either to compile from source by installing alternative python and C compilers via conda (
conda install -c conda-forge c-compiler) or to install the binary packages via conda as recommended at the top of this page.