-
Notifications
You must be signed in to change notification settings - Fork 175
Installing ANTsPy
Most users will install ANTsPy using binaries from PyPI, via pip install. It is recommended that you install into a dedicated conda, mamba, or venv that has a recent Python version.
Windows users will need a compatible Microsoft Visual C++ Redistributable installation.
Users in a shared computing environment, or who want to limit resource use, should set the environment variable ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS. This must be set before importing ants.
The easiest way to install ANTsPy is via the latest pre-compiled binaries from PyPI.
pip install antspyx
Or from conda:
conda install conda-forge::antspyx
Wheels are also available on the Github Releases page.
Wheels are built nightly for the latest Python with this action. Click the latest run and scroll down to see artifacts.
A more extensive build is run weekly here.
Note these wheels are only available for a limited time.
To build from source, clone the code and install with pip
pip install ./ANTsPy
You must have the appropriate development tools installed for this to work.
Some Mac OS Python installations have compatibility issues with the pre-compiled binaries. This means pip will not install binaries targeted for the current Mac OS version, and will instead try to compile from source. The compatibility checks can be disabled by setting the environment variable SYSTEM_VERSION_COMPAT=0. More details here.
Because ANTsPy includes C++ libraries, ANTsPy installed via pip may sometimes be incompatible with the system, even if the Python version matches. If this is the case, import ants will succeed but attempting to use any library function (like ants.image_read) will fail, often with a segmentation fault.
If using a system default python, try installing a newer python from Conda forge or python.org.