# Installation Installing nabu itself is quite easy. To install the latest release: ``` pip install nabu ``` To install the current development version ```bash 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](https://pypi.org/project/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](https://packaging.python.org/en/latest/tutorials/installing-packages/#creating-virtual-environments), unix commands, git, etc. First create a new virtual environment, here named `nabu`: ```bash 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](https://bootstrap.pypa.io/get-pip.py) ``` Make sure the newly created venv has up-to-date basic tools: ```bash pip install --upgrade pip setuptools wheel Cython ``` Then install the basic scientific software stack ```bash 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](http://www.silx.org/pub/wheelhouse). It's optional but will make the above command much faster. ```bash # 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: ```bash # 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](https://modules.readthedocs.io/en/latest) if available on your system - Use conda to get recent software (though it won't solve outdated drivers problems) ``` Now install scikit-cuda: ```bash # 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](https://pypi.org/project/pycudwt) (if you want to use the GPU Fourier-Wavelets rings removal on sinogram) ```bash # 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: ```bash pip install nabu ``` Done! Remember to activate the virtual environment (`source path/to/nabu/bin/activate`) when you log again.