Installing ODL using conda¶
Anaconda is a binary distribution package that allows user to install pre-compiled python packages in a very simple manner. It works on all platforms and is the recommended way of installing ODL as a user. If you already have anaconda installed, you can go directly to Installing ODL and its dependencies, otherwise you need to begin by installing anaconda.
Instructions for the impatient:
Download and install Miniconda
Create conda environment:
$ conda create -c odlgroup -n odl-py35 python=3.5 odl matplotlib pytest scikit-image spyder
Activate the conda enviroment and start working!
Even though a Python interpreter is included by default in virtually all Linux distributions, it is advisable to use Anaconda’s Python ecosystem since it gives you full flexibility in the Python version you use and which packages you install.
Download Anaconda from the Continuum Analytics home page. You may choose to download the full Anaconda variant, but we recommend the slim Miniconda distribution since many of the packages included in full Anaconda are out of date anyway and need to be updated. Note that the choice of Python version (2 vs. 3) of the Anaconda installer is not very important since you can later choose to create conda environments with any Python version (see below).
Make sure that during installation, your
PATH variable is adapted such that
conda and other scripts can be found by your shell:
Do you wish the installer to prepend the Miniconda3 install location to PATH in your /home/user/.bashrc ? [yes|no] [no] >>> yes
After restarting the terminal (for the changed
PATH variable to take effect), you can run
$ conda update --all
to make sure you have the latest versions of all packages.
Optionally, create a new conda environment to work with ODL. This is a very convenient way to have several “ecosystems” of Python packages in parallel without mutual interference:
$ conda create --name odl-py35 python=3.5
Enter the newly created conda environment by running
source activate odl-py35 (Linux/MacOS) or
activate odl-py35 (Windows).
If you want to exit later on, run
source deactivate (Linux/MacOS) or
deactivate (Windows), respectively.
See the Managing conda environments documentation for further information.
If you want to use Spyder as integrated development environment (IDE, see Development environment) on Linux or MacOS, you should also install it in the new conda environment and run it from there. Otherwise, Spyder may not able to use the packages in the conda environment:
$ conda install spyder
On Windows, you can install Spyder in the root conda environment (run
deactivate to get there), but you need to change its default Python interpreter.
To do this, open Spyder and use the navigation bar to open “Tools -> Preferences”.
Click on “Python interpreter” and change the first setting “Select the Python interpreter for all Spyder consoles” from the default setting to “Use the following Python interpreter:”.
In the text field, fill in the path to the Python executable in your newly created conda environment.
For example, if you installed Miniconda (or Anaconda) in
C:\Programs\Miniconda3, then the environment’s Python interpreter is
You can use the file system browser (symbol to the right of the text field) to find the interpreter on your system.
Installing ODL and its dependencies¶
Install ODL and all its (minimal) dependencies in a
conda environment of your choice by running
$ conda install -c odlgroup odl
To skip the
-c odlgroup option in the future, you can permanently add the
odlgroup conda channel (see Managing conda channels):
$ conda config --append channels odlgroup
conda install odl and
conda update odl work without the
Image and plot displaying capabilities using matplotlib:
$ conda install matplotlib
Faster FFT back-end using FFTW (currently not in mainstream conda):
Wavelet transforms (currently not in mainstream conda) using PyWavelets:
$ pip install pywavelets
Simple backend for ray transforms using scikit-image:
$ conda install scikit-image
Fast ASTRA ray transform backend:
$ conda install -c astra-toolbox astra-toolbox
If this doesn’t work, or if you want a more recent version, see the ASTRA GitHub page.
$ pip install proximal
More information can be found in Installing ODL extensions.
Running the tests¶
Unit tests in ODL are based on pytest. To run the tests, you first need to install the testing framework:
$ conda install pytest
Now you can check that everything was installed properly by running
$ python -c "import odl; odl.test()"
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.