1.. -*- mode: rst -*-
2.. ex: set sts=4 ts=4 sw=4 et tw=79:
3  ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
4  #
5  #   See COPYING file distributed along with the NiBabel package for the
6  #   copyright and license terms.
7  #
8  ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
9
10.. _installation:
11
12************
13Installation
14************
15
16NiBabel is a pure Python package at the moment, and it should be easy to get
17NiBabel running on any system. For the most popular platforms and operating
18systems there should be packages in the respective native packaging format
19(DEB, RPM or installers). On other systems you can install NiBabel using
20pip_ or by downloading the source package and running the usual ``python
21setup.py install``.
22
23.. This remark below is not yet true; comment to avoid confusion
24   To run all of the tests, you may need some extra data packages - see
25   :ref:`installing-data`.
26
27Installer and packages
28======================
29
30.. _install-pypi:
31
32pip and the Python package index
33--------------------------------
34
35If you are not using a Linux package manager, then best way to install NiBabel
36is via pip_.  If you don't have pip already, follow the `pip install
37instructions`_.
38
39Then open a terminal (``Terminal.app`` on OSX, ``cmd`` or ``Powershell`` on
40Windows), and type::
41
42    pip install nibabel
43
44This will download and install NiBabel.
45
46If you really like doing stuff manually, you can install NiBabel by downoading
47the source from `NiBabel pypi`_ .  Go to the pypi page and select the source
48distribution you want.  Download the distribution, unpack it, and then, from
49the unpacked directory, run::
50
51    pip install .
52
53If you get permission errors, this may be because ``pip`` is trying to install
54to the system directories.  You can solve this error by using ``sudo``, but we
55strongly suggest you either do an install into your "user" directories, like
56this::
57
58    pip install --user .
59
60or you work inside a virtualenv_.
61
62.. _install_debian:
63
64Debian/Ubuntu
65-------------
66
67Our friends at NeuroDebian_ have packaged NiBabel at `NiBabel NeuroDebian`_.
68Please follow the instructions on the NeuroDebian_ website on how to access
69their repositories. Once this is done, installing NiBabel is::
70
71  apt-get update
72  apt-get install python-nibabel
73
74Install a development version
75=============================
76
77If you want to test the latest development version of nibabel, or you'd like to
78help by contributing bug-fixes or new features (excellent!), then this section
79is for you.
80
81Requirements
82------------
83
84.. check these against setup.cfg
85
86*  Python_ 3.6 or greater
87*  NumPy_ 1.14 or greater
88*  Packaging_ 14.3 or greater
89*  SciPy_ (optional, for full SPM-ANALYZE support)
90*  h5py_ (optional, for MINC2 support)
91*  PyDICOM_ 0.9.9 or greater (optional, for DICOM support)
92*  `Python Imaging Library`_ (optional, for PNG conversion in DICOMFS)
93*  pytest_ (optional, to run the tests)
94*  sphinx_ (optional, to build the documentation)
95
96Get the development sources
97---------------------------
98
99You can download a tarball of the latest development snapshot (i.e. the current
100state of the *master* branch of the NiBabel source code repository) from the
101`NiBabel github`_ page.
102
103If you want to have access to the full NiBabel history and the latest
104development code, do a full clone (AKA checkout) of the NiBabel
105repository::
106
107  git clone https://github.com/nipy/nibabel.git
108
109Installation
110------------
111
112Just install the modules by invoking::
113
114  pip install .
115
116See :ref:`install-pypi` for advice on what to do for permission errors.
117
118Validating your install
119-----------------------
120
121For a basic test of your installation, fire up Python and try importing the
122module to see if everything is fine.  It should look something like this::
123
124    Python 2.7.8 (v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35)
125    [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
126    Type "help", "copyright", "credits" or "license" for more information.
127    >>> import nibabel
128    >>>
129
130
131To run the nibabel test suite, from the terminal run ``pytest nibabel`` or
132``python -c "import nibabel; nibabel.test()``.
133
134To run an extended test suite that validates ``nibabel`` for long-running and
135resource-intensive cases, please see :ref:`advanced_testing`.
136
137.. include:: links_names.txt
138