Installation — Bonsu - The Interactive Phase Retrieval Suite 3.0 documentation

# Installation

## Installation on Mac OS X

If a native Python environment is used, ensure that all dependencies are installed, ideally from the Python Package Index using pip. They are listed below.

- wxPython 2.8.10

- NumPy 1.4.1

- VTK 5.4.2 .

- Pillow

- H5Py

A stand alone python distribution such as Anaconda Python or Enthought Canopy will likely include all of the above prerequisites.

It is then possible to install Bonsu from the Python Package Index using the following command:

    $ pip install bonsu

## Installation on Windows

Download 64-bit Python 2.7 or 3.6 for Microsoft Windows from the Python website and follow the installation instructions. Ensure that pip is included in the installation. Prerequisite binaries are available for download in the Python Package Index. They are also listed below.

- wxPython 2.8.10

- NumPy 1.4.1

- VTK 5.4.2 .

- Pillow

- H5Py

Prerequisites are installed using the pip command found in the PythonScript folder. For example:

    $ pip.exe install wxpython

Note

Prebuilt VTK packages 7.0 in PyPI generally requre a graphics card with OpenGL 3 support. VTK packages that do not require OpenGL 3 compatible graphics cards can be found here .

Alternatively, it is possible to install a stand alone python distribution such as Anaconda Python or Enthought Canopy. This will likely include all of the above prerequisites.

It is then possible to install Bonsu from the `Python Package Index <https://pypi.org>`_using the following command

    $ pip.exe install bonsu

## Installation on Linux/Unix

### System Preparation

Before Bonsu can be installed from source, a number of software packages are required. They are namely:

- Python

- wxPython 2.8.10

- FFTW with threading 3.0

- NumPy (FFTW aware) 1.4.1

- VTK (compiled with python bindings) 5.8

- Python Imaging Library (Pillow)

- A reasonably new c++compiler such as gcc

Others optional packages include:

- H5Py 1.8

As most Linux systems and services require Python natively, it is likely that Python is already provided in your distribution. Also, many distributions package all of the above prerequisites. Please check your distributions repositories.

It is also possible to install a stand alone python distribution such as that provided by Enthought. This will include most of the above prerequisites. In order to compile and use any additional packages (such as FFTW) into the stand alone distribution, a number of environmental variables should be set. If you are using the Bourne-again (BASH) shell, append something akin to the following in your `.bashrc` profile:

    export EPD="/path/to/python/installation/"
    export PYVER="2.7"
    export PYTHONSITE=$EPD/lib/python$PYVER/site-packages
    export PYTHONPATH=$EPD/lib:$EPD/lib/python$PYVER/:
    export PATH=/bin:/usr/bin/:/usr/local/bin:$EPD/bin/:$EPD/include:.
    alias python=$EPD/bin/python
    export INSTALL_PREFIX=$EPD
    export PREFIX=$EPD
    export prefix=$EPD
    export LIBDIR=$EPD/lib
    export CC=gcc
    export CFLAGS="-m64 -O2 -ftree-vectorize -fPIC -mieee-fp"
    export LDFLAGS="-L$EPD/lib -L$EPD/lib/python$PYVER/site-packages/vtk/"
    export CPPFLAGS=${CFLAGS}
    export CXXFLAGS=${CFLAGS}
    export FFLAGS=${CFLAGS}
    export FCFLAGS=${CFLAGS}

Warning

It is essential to modify the above environmental variables to suite the chosen system type (32-bit or 64-bit) and stand alone Python package version(s).

### Note on Building FFTW

To build FFTW into a stand alone python distribution such as that provided by Enthought , use the following sequence of commands:

    $ ./configure --prefix=${PREFIX} --enable-threads --enable-shared
    $ make
    $ make install

### Installing Bonsu

Source code for Bonsu is available for download here.

See also

https://github.com/bonsudev/bonsu

Unpack the source code with the following:

    $ tar -xvf Bonsu-{x}.tar.gz

where x is the current version.

Enter the newly created directory and first build the source:

    $ python setup.py build

If this is successful you will now have a fully prepared built source tree for installation. To install the package type the following (super user privileges may be required):

    $ python setup.py install

To install the package to a non-default location (perhaps where super user privileges are not required) use the following command:

    $ python setup.py install --home=/my/install/path

The `--home` option defines the installation base directory. Files are installed to the following directories under the installation base as follows

Type of file | Installation directory
--- | ---
modules | `home/lib/python`
scripts | `home/bin`
data | `home`
C headers | `home/include/python/distname`

To make Python find the distributions installed with this scheme, it is necessary to modify Python’s search path(s) to include the above.

To start the program, execute the following from the command line:

    $ bonsu &

Note

For Linux users, a link to the program should be visible in the applications menu.