Installation

Installing nabu itself is quite easy. To install the latest release:

pip install nabu

To install the current development version

pip install git+https://gitlab.esrf.fr/tomotools/nabu.git

Dependencies

The most complicated part, when it comes to install nabu, is the installation of its optional dependencies:

  • Computations acceleration (GPU/manycore CPU): pycuda, scikit-cuda

  • Image processing and fitting utils: scikit-image

Frequently asked questions

Does nabu need a GPU ?

No. Nabu can reconstruct a full volume without needing a GPU.

That being said:

  • The overall process will likely be slow

  • The FBP steps still requires pyopencl, and OpenCL ICD/implementation installed on the host

Technically speaking, the reference implementation for each individual step (flat-field, filtering, etc) is in Python/numpy.

That’s why a GPU is recommended (not required) if you want to use nabu.

Which OS/python version are supported ?

  • Nabu is only tested on Linux. As it is primarily designed for running on a compute cluster, there is no plan to support Windows or MacOS. Pull requests for fixes on these platforms will still be welcome.

  • Nabu supports Python >= 3.5, though at this point many of its dependencies will probably require python >= 3.6 or 3.7.

What about conda ?

Currently there is no conda recipe for nabu. There might be in the future.

Installing nabu from (almost) scratch, using pip

In this section, it is assumed that you know the basics about python virtual environment, unix commands, git, etc.

First create a new virtual environment, here named nabu:

python3 -m venv nabu
source nabu/bin/activate

Note

If venv is not installed on your system, ask your system administrator to install it or consider using get-pip.py

Make sure the newly created venv has up-to-date basic tools:

pip install --upgrade pip setuptools wheel Cython

Then install the basic scientific software stack

pip install cycler certifi
pip install numpy scipy h5py matplotlib lxml fabio
pip install silx

Note

The installation commands have to be run in this order, otherwise problems might pop up (eg. pip unable to guess matplotlib version to install if cycler/certify are not already installed)

If you have a power9 processor, you can get python wheels from silx wheelhouse. It’s optional but will make the above command much faster.

# only if you have a power9 CPU, use this command instead
pip install --trusted-host www.silx.org --find-links http://www.silx.org/pub/wheelhouse/ --no-index numpy scipy h5py matplotlib lxml fabio

Now let’s install pycuda. Here is an example procedure:

# pycuda installation script fragment
PYCUDA_BUILDDIR="/tmp/pycuda_$(whoami)"
PYCUDA_REPO_URL="https://github.com/inducer/pycuda"
git clone "$PYCUDA_REPO_URL" "$PYCUDA_BUILDDIR"
cd "$PYCUDA_BUILDDIR"
git submodule update --init
rm -f siteconf.py
# curand might have different versions across machines. Disable it.
python configure.py --no-cuda-enable-curand
# pycuda wants old versions of numpy for build. Here we use the available numpy version.
pip install --no-build-isolation .
cd -

Note

If you encounter a compilation-related issue at this stage, it can have different causes:

  • outdated boost library

  • outdated cuda toolkit and/or nvidia driver

In any case, the problem comes from the operating system, and there is little this tutorial can do to help.

Solutions can be:

  • Upgrade OS components (nvidia-cuda-toolkit, nvidia-driver, …)

  • Use environment modules if available on your system

  • Use conda to get recent software (though it won’t solve outdated drivers problems)

Now install scikit-cuda:

# scikit-cuda does not have recent release on pypi. Use the repo version
pip install git+https://github.com/lebedov/scikit-cuda

Optionally, install pycudwt (if you want to use the GPU Fourier-Wavelets rings removal on sinogram)

# Provide the compute capability of the GPU in the form "86" (for 8.6).
# See https://en.wikipedia.org/wiki/CUDA#GPUs_supported
PYCUDWT_CC=86 pip install --no-build-isolation --no-cache-dir "pycudwt"

Finally, install nabu:

pip install nabu

Done! Remember to activate the virtual environment (source path/to/nabu/bin/activate) when you log again.