File size: 4,991 Bytes
6dbba9b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | ## Installing specific versions
We cannot store the entire history of releases because storage space on `pip` is limited. If you need an older release, you can check the [Github Releases page](https://github.com/ANTsX/ANTsPy/releases) or
build from source.
which will attempt to build from source (requires a machine with developer tools).
## Recent wheels
Non-release commits have wheels built automatically, which are available for download for a limited period.
Look under the [Actions tab](https://github.com/ANTsX/ANTsPy/actions). Then click on the commit for the software version you want.
Recent commits will have wheels stored as "artifacts".
Wheels are built locally like this:
```
rm -r -f build/ antspymm.egg-info/ dist/
python3 setup.py sdist bdist_wheel
pipx run twine upload dist/*
```
## Docker images
Available on [Docker Hub](https://hub.docker.com/repository/docker/antsx/antspy). To build
ANTsPy docker images, see the (installation tutorial)(https://github.com/ANTsX/ANTsPy/blob/master/tutorials/InstallingANTsPy.md#docker-installation).
## Other notes on compilation
In some cases, you may need some other libraries if they are not already installed eg if cmake says something about
a missing png library or a missing `Python.h` file.
```
sudo apt-get install libblas-dev liblapack-dev
sudo apt-get install gfortran
sudo apt-get install libpng-dev
sudo apt-get install python3-dev # for python3.x installs
```
### Build documentation
```
cd docs
sphinx-apidoc -o source/ ../
make html
```
## Installation methods
### Method 1: Pre-Compiled Binaries (preferred)
The fastest method is to install the pre-compiled binaries for the latest
stable, weekly release (takes ~1 min):
If you have MacOS:
```bash
pip install https://github.com/ANTsX/ANTsPy/releases/download/v0.1.8/antspyx-0.1.8-cp37-cp37m-macosx_10_14_x86_64.whl
```
If you have Linux:
```bash
pip install https://github.com/ANTsX/ANTsPy/releases/download/v0.2.0/antspyx-0.2.0-cp37-cp37m-linux_x86_64.whl
```
---
### Method 2: Github Master Branch
If you want the latest code, you can install directly from source (takes ~45 min):
```bash
pip install git+https://github.com/ANTsX/ANTsPy.git
```
with an option to specify the branch or particular release by `@v0.1.6` on the end of the path.
---
### Method 3: PyPI Source Distribution
If this doesn't work, you should install the latest stable source release from PyPI (takes ~45 min):
```bash
pip install -v antspy
```
ANTsPy will by default install with VTK in order to use the visualization functions such as
`ants.surf` and `ants.vol`. If you dont want VTK support, use the following:
```bash
git clone https://github.com/ANTsX/ANTsPy.git
cd ANTsPy
python setup.py install --novtk
```
### Method 4: Development Installation
If you want to develop code for ANTsPy, you should install the project as follows and
then refer to the [contributor's guide](CONTRIBUTING.md) for notes on project structure
and how to add code.
```bash
git clone https://github.com/ANTsX/ANTsPy.git
cd ANTsPy
python setup.py install
```
ANTsPy is known to install on MacOS, Ubuntu, and CentOS - all with Python3.6. It does not
currently work on Python 2.7, but we're planning on adding support.
## CentOS Installation
To install ANTsPy on CentOS (tested on "7") with virtual environment,
follow these commands:
background:
- follow python3.6 installation from [here](https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-centos-7)
- create a virtual environment.
- clone `ANTsPy`
then call
```
sudo python3.6 setup.py develop
```
To use the toolkit, you then need to install dependencies:
```
pip3.6 install numpy
pip3.6 install pandas
pip3.6 install pillow
pip3.6 install webcolors
pip3.6 install plotly
pip3.6 install matplotlib
sudo yum --enablerepo=ius-archive install python36u-tkinter
```
after this, you may try to run examples such as the following:
```
help( ants.vol )
help( ants.sparse_decom2 )
```
---
## Docker Installation
Tested on Ubuntu Linux (arch amd64), a standard docker command will build ANTsPy
```
cd ANTsPy
docker build -t antspy:latest .
```
For cross-platform builds with buildx, the following is suggested by @jennydaman:
```
# enable QEMU emulation for targeted foreign architectures
docker run --rm --privileged aptman/qus -s -- -p ppc64le aarch64
# enable advanced buildx features such as multi-platform support
docker buildx create --name moc_builder --use
# build the container image, using 6 make jobs
# (2 concurrent builds each using 6 jobs, recommended to have 12 CPU cores)
# targeting the platforms amd64 and ppc64le
# updating the base image first
# and finally pushing the result to a container registry
docker buildx build --pull --build-arg j=6 -t dockeruser/antspy:latest --platform linux/amd64,linux/ppc64le,linux/arm64 --push .
# optional clean-up
docker buildx rm
docker run --rm --privileged aptman/qus -- -r
```
|