Installing ODL from source

This installation method is intended for developers who want to make changes to the code and users that need the cutting edge.

TL;DR

Instructions for the impatient:

  • Clone ODL from git:

    $ git clone https://github.com/odlgroup/odl
    
  • Install ODL

    $ cd odl
    $ pip install [--user] --editable .
    

    Don't use the --user option together with conda.

  • Install the extensions you want.

Introduction

This guide assumes that the Git version control system is available on your system; for up-to-date instructions, consult the Git installation instructions. You also need pip to perform the installation.

Note

You should consider performing all described steps in a conda environment -- it gives you the same encapsulation benefits as developer that you would enjoy also as a user (no conflicting packages, free to choose Python version, ...). See the Installing Anaconda section for setup instructions.

To get ODL, navigate to a folder where you want the ODL repository to be stored and clone the repository with the command

$ git clone https://github.com/odlgroup/odl

No GitHub account is required for this step.

In a conda environment

This part assumes that you have activated a conda environment before (see Installing Anaconda).

You can choose to install dependencies first:

  • On Linux/MacOS:

    $ conda install nomkl numpy scipy future matplotlib
    
  • On Windows:

    $ conda install numpy scipy future matplotlib
    

After that, enter the top-level directory of the cloned repository and run

$ pip install --editable .

Optional dependencies:

You may also want to install optional dependencies:

$ conda install matplotlib pytest pytest-pep8

Using only pip

Enter the top-level directory of the cloned repository and run

$ pip install --user --editable .

Note

Don't forget the "." (dot) at the end - it refers to the current directory, the location from where pip is supposed to install ODL.

Note

We recommend the --editable option (can be shortened to -e) since it installs a link instead of copying the files to your Python packages location. This way, local changes to the code (e.g. after a git pull) take immediate effect after reloading the package, without requiring re-installation.

Optional dependencies:

You may also want to install optional dependencies:

$ pip install --user .[testing, show]

Extra dependencies

As a developer, you may want to install further optional dependencies. Consult the pip or conda guide for further instructions.

Running the tests

Unit tests in ODL are based on pytest. They can be run either from within odl or by invoking pytest directly.

First, you need to install the testing dependencies using your favorite method below.

  • Using conda:

    $ conda install pytest
    
  • Using pip:

    $ pip install --user odl[testing]
    

Now you can check that everything was installed properly by running

$ python -c "import odl; odl.test()"

Note

If you have several versions of ODL and run this command in the top-level directory of an ODL clone, the tests in the repository will be run, not the ones in the installed package.

You can also use pytest directly in the root of your ODL clone:

$ pytest

For more information on the tests, see Testing in ODL.

Further developer information

See Contributing to ODL for more information.