DIPY is in active development. You can install it from our latest release, but
you may find that the release has gotten well behind the current development -
at least - we hope so - if we’re developing fast enough! If you want to install the latest and greatest from the bleeding edge of the
development, skip to Installing from source. If you just want to install a released
version, read on for your platform. If you are on Debian or Ubuntu Linux we recommend you try
Using Anaconda: first. Otherwise please try Using pip:. On all platforms, you can use Anaconda to install DIPY. To do so issue the following command in a terminal: Some of the visualization methods require the FURY library and this can be installed separately (for the time being only on Python 3.4+): First, install the python library dependencies. One easy way to do that is to
use the Anaconda distribution (see below for Alternatives to Anaconda). Even with Anaconda installed, you will still need to install the nibabel
library, which supports reading and writing of neuroimaging data formats. Open
a terminal and type: Finally, we are ready to install DIPY itself. Same as with nibabel above,
we will type at the terminal shell command line: When the installation has finished we can check if it is successful in the following way. From a Python console script try: This should work with no error. Some of the visualization methods require the FURY library and this can be installed by doing To use DIPY, you need to have some Dependencies installed. First of all, make sure that you have installed the Apple Xcode developer tools. You’ll need those to install all the following dependencies. Next, install the python library dependencies. One easy way to do that is to use the Anaconda distribution (see below for Alternatives to Anaconda). Even with Anaconda installed, you will still need to install the nibabel library, which supports the reading and writing of neuroimaging data formats. Open a terminal and type: Finally, we are ready to install DIPY itself. Same as with nibabel above, we will type at the terminal shell command line: When the installation has finished we can check if it is successful in the following way. From a Python console script try: This should work with no error. Some of the visualization methods require the FURY library and this can be installed by doing: For Debian, Ubuntu and Mint set up the NeuroDebian repositories - see
NeuroDebian how to. Then: We hope to get packages for the other Linux distributions, but for now, please
try Using pip: instead. This method should work under Linux, Mac OS X, and Windows. Please install numpy and scipy using their respective binary installers if
you haven’t already. For Windows and Mac OSX you can use Anaconda to get numpy, scipy, cython and lots
of other useful python modules. Anaconda is a big package but will install many
tools and libraries that are useful for scientific processing. When you have numpy, scipy and cython installed then try: Then from any python console or script try: Do these installation instructions work for you? For any problems/suggestions please let us know by sending us an e-mail to the nipy mailing list with the subject line starting with Make sure that you have uninstalled all previous versions of DIPY before installing a new one. A simple and general way to uninstall DIPY is by removing the installation directory. You can find where DIPY is installed by using: and then remove the DIPY directory that contains that file. If you have problems installing Anaconda we recommend using Canopy or pythonxy. DIPY can process large diffusion datasets. For this reason, we recommend using a 64bit operating system that can allocate larger memory chunks than 32bit operating systems. If you don’t have a 64bit computer that is okay DIPY works with 32bit too. Most DIPY functionality can be used with Python versions 2.6 and newer, including Python 3.
However, some visualization functionality depends on FURY, which only supports Python 3 in versions 7 and newer. More likely you will want to get the source repository to be able to follow the
latest changes. In that case, you can use: For more information about this see Following the latest source. After you’ve cloned the repository, you will have a new directory, containing
the DIPY Change directory into the DIPY source root directory. To clean your directory from temporary file, use: This command will delete all files not present in your github repository. Then, complete your installation by using this command: remove the old dipy installation if present build dipy (equivalent to python setup.py build_ext –inplace) install dipy locally on your user environment Change directory into the DIPY source root directory. To install for the system: To build DIPY in the source tree (locally) so you can run the code in the source tree (recommended for following the latest source) run: add the DIPY source root directory into your When adding dipy to the After changing the or: so that you can have immediate access to DIPY without needing to
restart your terminal. then: (we need the latest version of this one - hence You might want the optional packages too (highly recommended): Now follow Install from source for Unix (e.g Linux, OSX). Same as above but use yum rather than apt-get when necessary. Now follow Install from source for Unix (e.g Linux, OSX). Anaconda is probably the easiest way to install the dependencies that you need.
To build from source, you will also need to install the exact compiler which is
used with your specific version of python. For getting this information, type this command in shell like This command should print information of this form: Now that you find the relevant compiler, you have to install the VisualStudioBuildTools
by respecting the following table: After the VisualStudioBuildTools installation, restart a command shell and
change directory into the DIPY source root directory. To install into your system: To install inplace - so that DIPY is running out of the source code directory: (this is the mode we recommend for following the latest source code). If you
get an error with If you get an error saying “unable to find vcvarsall.bat” then you need to
check your environment variable Make sure you have Xcode and Anaconda installed. From here follow the Install from source for Unix (e.g Linux, OSX) instructions. OpenMP is a standard library for efficient multithreaded applications. This
is used in DIPY for speeding up many different parts of the library (e.g., denoising
and bundle registration). If you do not have an OpenMP-enabled compiler, you can
still compile DIPY from source using the above instructions, but it might not take
advantage of the multithreaded parts of the code. To be able to compile
DIPY from source with OpenMP on Mac OSX, you will have to do a few more things. First
of all, you will need to install the Homebrew package manager. Next, you will need
to install and configure the compiler. You have two options: using the GCC compiler
or the CLANG compiler. This depends on your python installation: If you are using Anaconda, you will need to use GCC. The first option is to run the following command: After this installation, gcc will be your default compiler in Anaconda environment. The second option is to install gcc via homebrew. Run the following: This should take about 45 minutes to complete. Then add to your bash
configuration (usually in If you are already using the Homebrew Python, or the standard python.org Python,
you will need to use the CLANG compiler with OMP. Run: And then edit the Whether you are using Anaconda or Hombrew/python.org Python, you will need to then
run If you want to run the tests: Then (in python or ipython): You can also run the examples in To build the documentation in HTML in your computer you will need to do: Then change directory to Building the entire If you encounter the following error when trying to build the documentation: it is probably due to a conflict between the picked Installation
Installing a release
Using Anaconda:
conda install -c conda-forge dipy
conda install -c conda-forge fury
Using packages:
Windows
pip install nibabel
pip install dipy
>>> import dipy
pip install fury
OSX
pip install nibabel
pip install dipy
>>> import dipy
pip install fury
Linux
sudo apt-get install python-dipy
Using pip:
pip install nibabel
pip install dipy
>>> import dipy
Support
Contact us:
[DIPY]
.Common problems:
Multiple installations
import dipy
dipy.__file__
Alternatives to Anaconda
Memory issues
Note on python versions
Installing from source
Getting the source
git clone https://github.com/dipy/dipy.git
setup.py
file, among others. We’ll call this directory - that
contains the setup.py
file - the DIPY source root directory. Sometimes
we’ll also call it the <dipy root>
directory.Building and installing
Install from source (all operating systems)
git clean -fxd
pip install --user -e .
Install from source for Unix (e.g Linux, OSX)
python setup.py install
python setup.py build_ext --inplace
PYTHONPATH
environment variable. Search google for PYTHONPATH
for details or see python module path for an introduction.PYTHONPATH
, we usually add the PYTHONPATH
at
the end of ~/.bashrc
or (OSX) ~/.bash_profile
so we don’t need to
retype it every time. This should look something like:export PYTHONPATH="/home/user_dir/Devel/dipy:$PYTHONPATH"
~/.bashrc
or (OSX) ~/.bash_profile
try:source ~/.bashrc
source ~/.bash_profile
Ubuntu/Debian
sudo apt-get install python-dev python-setuptools
sudo apt-get install python-numpy python-scipy
sudo apt-get install cython
sudo pip install nibabel
pip
rather than
apt-get
).sudo apt-get install ipython python-h5py python-vtk python-matplotlib
Fedora / Mandriva maybe Redhat
Windows
cmd
or Powershell:python -c "import platform;print(platform.python_compiler())"
MSC v.1900 64 bit (AMD64)
Visual C++ 2008 (9.0) MSC_VER=1500
Visual C++ 2010 (10.0) MSC_VER=1600
Visual C++ 2012 (11.0) MSC_VER=1700
Visual C++ 2013 (12.0) MSC_VER=1800
Visual C++ 2015 (14.0) MSC_VER=1900
Visual C++ 2017 (15.0) MSC_VER=1910
python setup.py install
python setup.py develop
python setup.py develop
make sure you have installed
setuptools.PATH
or reinstall VisualStudioBuildTools.
Setuptools should automatically detect the compiler and use it.OSX
OpenMP with OSX
Under Anaconda
conda install gcc
brew reinstall gcc --without-multilib
~/.bash_profile
), the following:export PATH="/usr/local/Cellar/gcc/5.2.0/bin/gcc-5:$PATH"
Under Homebrew Python or python.org Python
brew install clang-omp
setup.py
file to include the following line (e.g., on line 14,
at the top of the file, but after the initial imports):os.environ['CC'] = '/usr/local/bin/clang-omp'
Building and installing
python setup.py install
. When you do that, it should now
compile the code with this OpenMP-enabled compiler, and things should go faster!Testing
sudo pip install pytest
>>> import dipy
>>> dipy.test()
<dipy root>/doc
.Documentation (Unix only)
sudo pip install sphinx
<dipy root>
and:cd doc
make clean
make html
Tip
DIPY
documentation takes a few hours. You may want to
skip building the documentation for the examples, which will reduce the
documentation build time to a few minutes. You can do so by executing:make -C . html-after-examples
Troubleshooting
tools/build_modref_templates.py dipy reference
*WARNING* API documentation not generated: Can not import dipy
tools/docgen_cmd.py dipy reference_cmd
*WARNING* Command line API documentation not generated: Cannot import dipy
Build API docs...done.
cd examples_built && ../../tools/make_examples.py
Traceback (most recent call last):
File "../../tools/make_examples.py", line 33, in <module>
import dipy
ModuleNotFoundError: No module named 'dipy'
Sphinx
version: this
happens when the system’s Sphinx
package is used instead of the virtual
environment’s Sphinx
package, and the former trying to import a DIPY
version in the system: the Sphinx
package used should correspond to that of
the virtual environment where DIPY
lives. This can be solved by specifying
the path to the Sphinx
package in the virtual environment:make html SPHINXBUILD='python <path_to_sphinx>/sphinx-build'