Skip to content
Thomas Nipen edited this page Nov 1, 2022 · 42 revisions

Installing the python bindings on Linux

The easiest is to install the latest release of the package using pip, which comes with precompiled binaries so no non-python dependencies are required:

pip install gridpp --user

Precompiled binaries are available for Python 2.7 and 3.5-3.11. To check that the installation worked, run the following in python:

import gridpp
print(gridpp.version())

Full gridpp installation from source

1) Install dependencies

On Ubuntu Bionic, these can be installed like this:

sudo apt-get update
sudo apt-get install libboost-all-dev
sudo apt-get install libgsl0-dev libblas-dev
sudo apt-get install netcdf-bin libnetcdf-dev
sudo apt-get install libarmadillo6 libarmadillo-dev
sudo apt install swig cmake

Note that Ubuntu Xenial only has Armadillo 6.5 in its apt repository. In that case you need to install Armadillo 6.6 or later manually.

2) Download source code

Either download the source code from the latest release, unzip the file and navigate into the extracted folder; or clone the repo from github.

3) Set up cmake installation

mkdir build
cd build
cmake ..

4) Install the C++ library

sudo make install

This will install the library in /usr/local/lib/libgridpp.so and the gridpp command-line client in /usr/local/bin/gridpp. To specify a custom installation path, use the following in step 3:

cmake .. -DCMAKE_INSTALL_PREFIX=<custom path>

5) Install the python bindings

make install-python-user

This installs the python bindings in ~/local/lib/python3.6/site-packages/gridpp.py. To install the python bindings system-wide, use sudo make install-python instead.

If you only want to build the package, and want to install it in a custom location instead, run:

make build-python

and copy extras/SWIG/python/gridpp.py and extras/SWIG/python/_gridpp.so to the desired location.

6) Install the R bindings

make build-r

Currently, the R package is not installed centrally, but instead is placed in extras/SWIG/R/gridpp.R in the build directory.

Clone this wiki locally