# 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

- NumPy

- VTK

- Pillow

- H5Py

- Cython

- hdf5plugin (optional)

A stand alone python distribution such as Anaconda Python 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

If the optional hdf5plugin module is required, use the following command:

    $ pip install bonsu[hdf5plugin]

To install in the conda environment, run the following in the terminal or an Anaconda Prompt:

    $ conda install -c conda-forge bonsu

## Installation on Windows

Download 64-bit Python 3.7 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

- NumPy

- VTK

- Pillow

- H5Py

- Cython

- hdf5plugin (optional)

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

    $ pip install wxpython

Note

Prebuilt VTK packages 7.0 in PyPI generally requre a graphics card with OpenGL 3 support.

Alternatively, it is possible to install a stand alone python distribution such as Anaconda Python . This 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

If the optional hdf5plugin module is required, use the following command:

    $ pip install bonsu[hdf5plugin]

## 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

- FFTW with threading

- NumPy (FFTW aware)

- VTK (compiled with python bindings)

- Python Imaging Library (Pillow)

- H5Py

- Cython

- hdf5plugin (optional)

- A reasonably new c++compiler such as gcc

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 Anaconda. 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. In Anaconda Python, ensure that you create and activate your local environment:

    $ conda create --name myenv
    $ conda activate myenv
    $ export PREFIX="/path/to/conda/myenv/"

### 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 --prefix=/my/custom/install/path

The `--prefix` option defines the installation base directory. To allow Python to find the distributions installed with this scheme, it may be 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.

### HDF5 Plugins

If HDF5 plugins are installed to a non-default location, h5py might require the following environmental variable:

    $ export HDF5_PLUGIN_PATH=/path/to/plugins.so/folder

### Remote Access

If Bonsu is used remotely via X11 fowarding or X2Go (NX technology), errors with rendering might occur dependent on the available graphics hardware. A possible workaround is to add the following environment variables to your .bashrc script:

    $ export LIBGL_ALWAYS_SOFTWARE=true
    $ export MESA_GL_VERSION_OVERRIDE=3.2
    $ export MESA_GLSL_VERSION_OVERRIDE=150