dipy logo

Site Navigation

NIPY Community

Table Of Contents

Previous topic

Mission statement

Next topic

Examples

Installation

dipy is in active development at the moment. You can install it from our latest release, but you may find that the release has got well behind the current development - at least - we hope so - if we’re developing fast enough!

Note on python versions

Sorry, but dipy does not yet work with python 3 - so all the instructions following instructions apply to python 2.5 or python 2.6 or python 2.7.

On OSX we always use the python binaries available from the python.org downloads, and not the python that comes with the OSX system. If you don’t have the python.org python you need to go to http://python.org/downloads, then download and install the python version you want (2.7 or 2.6 or 2.5). Check that you have this version on your path (perhaps after . ~/.bash_profile) with which python. This should show something like:

/Library/Frameworks/Python.framework/Versions/2.6/bin/python

We’ve compiled dipy against this python, and all our testing on OSX too.

Installing a release

If you are on Debian or Ubuntu Linux we recommend you try Using packages first. Otherwise please try install-easy-install.

Using easy_install

See first the Note on python versions.

In case easy_install is not installed then please install setuptools or distribute_.

Please install numpy and scipy using their respective binary installers if you haven’t already.

For windows you can use pythonxy to get numpy and scipy and lots of other useful python packages. This is quite a big package but will install lots of python stuff that is useful for your scientific endeavors.

When you have numpy and scipy installed then try

easy_install dipy

This command should work under Linux, Mac OS X and Windows.

Then from any python console or script try

>>> import dipy

Does it work? 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 [dipy].

By the way, you might be tempted to try and run the tests after installing with easy_install. Unfortunately this doesn’t work because of a problem with easy_install. To run the tests you need to install from source on windows or mac, or via a package on Linux (source also works on Linux).

Using packages

Windows

Download and install numpy and scipy - or install pythonxy. Install nibabel from nibabel pypi using the .exe installer. Install dipy from dipy pypi using the .exe installer for your version of python.

Then from any python console or script try

>>> import dipy

OSX

Download and install numpy and scipy using the OSX binary packages for your distribution of python. Install nibabel from nibabel pypi using the .mpkg installer for your version of python. Install dipy from dipy pypi using the .mpkg installer for your version of python.

Then from any python console or script try

>>> import dipy

Linux

For Debian and Ubuntu, set up the NeuroDebian repositories - see NeuroDebian how to. Then:

sudo apt-get install python-dipy

We hope to get packages for the other Linux distributions, but for now, please try Using easy_install instead.

Installing from source

Getting the source

You can get the released source zip file or tar.gz archive from dipy pypi.

If you want the latest development source as an archive, go to the dipy github page, and click on the Download button.

More likely you will want to get the source repository to be able to follow the latest changes. In that case, see Following the latest source.

After you’ve unpacked the archive or cloned the repository, you will have a new directory, containing the dipy 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

Windows

pythonxy is probably the easiest way to install the dependencies that you need.

Otherwise you will need python (obviously). You’ll need to install the mingw compiler suite if you don’t have a c compiler on your machine. We suggest you run the mingw automated installer, and install the developer tools, including msys_. Don’t forget to put the mingw bin directory on your path so python can find the compiler. Install numpy, scipy, nibabel and cython from their respective binary installers. All of these come with pythonxy . You can also install them from their Windows binary installers. You’ll find these by following the links from their home pages.

Start a command shell like cmd or Powershell_ and change directory into the dipy source root directory.

To install into your system:

python setup.py install --compiler=mingw32

To install inplace - so that dipy is running out of the source code directory:

python setup.py develop

(this is the mode we recommend for following the latest source code). If you get an error with python setup.py develop make sure you have installed setuptools.

If you get an error saying “unable to find vcvarsall.bat” then you need to create a file called “pydistutils.cfg” in notepad and give it the contents

[build]
compiler=mingw32

Save this into your system python distutils directory as distutils.cfg. This will be something like C:\Python26\Lib\distutils\distutils.cfg.

OSX

See the Note on python versions for which python you need.

Make sure you have Xcode installed.

Download and install numpy and scipy from their respective download sites. Chose the version for your versions of OSX and python. Install cython. This is probably most easily done with:

sudo easy_install cython

Install nibabel

sudo easy_install nibabel

From here follow the Install from source for unices (e.g Linux, OSX) instructions.

Ubuntu/Debian

sudo apt-get install python-dev python-setuptools
sudo apt-get install python-numpy python-scipy

then:

sudo easy_install cython
sudo easy_install nibabel

(we need the latest version of these two - hence easy_install rather than apt-get).

You might want the optional packages too (highly recommended):

sudo apt-get install ipython python-tables python-vtk python-matplotlib

Now follow Install from source for unices (e.g Linux, OSX).

Fedora / Mandriva maybe Redhat

Making this up, but:

yum install gcc-c++
yum install python-devel
yum install python-setuptools
yum install numpy scipy

Then:

sudo easy_install cython
sudo easy_install nibabel

Options:

yum install ipython
yum install python-matplotlib python-vtk python-tables

Now follow Install from source for unices (e.g Linux, OSX).

Install from source for unices (e.g Linux, OSX)

Change directory into the dipy source root directory .

To install for the system:

python setup.py install

To build in the source tree so you can run the code in the source tree (recommended for following the latest source) either:

  • option 1 - using setup.py develop:

    python setup.py develop
  • option 2 - putting dipy into your search path manually. This is more long-winded but a bit easier to understand what’s going on:

    python setup.py build_ext --inplace

    and then symlink the <dipy-root>/dipy directory into a directory on your python path (>>> import sys; print sys.path) or add the dipy source root directory into your PYTHONPATH environment variable. Search google for PYTHONPATH for details or see python module path for an introduction.

    When adding dipy to the 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:/home/user_dir/Devel/nibabel

    After changing the ~/.bashrc or (OSX) ~/.bash_profile try:

    source ~/.bashrc

    or:

    source ~/.bash_profile

    so that you can have immediate access to dipy without needing to restart your terminal.

If you want to run the tests:

sudo easy_install nose

Then (in python or ipython):

>>> import dipy
>>> dipy.test()

You can also run the examples in <dipy root>/doc.

To build the documentation you will need:

sudo easy_install -U sphinx

Then change directory to <dipy root> and:

make html

to make the html documentation.