Cmake error while installing Pygplates

Hi Harsha,

It looks like you have activated a conda environment (that you’ve name pygmt).

Did you install the dependencies as Ubuntu packages or using conda? I’m assuming the former since you mention the DEPS.Linux file which only covers the former. If not, then it’s best to install the dependencies using conda (when you’ve activated a conda environment).

Here are the steps I’ve used to build pygplates using conda dependencies:

Firstly I add the conda-forge channel and force the use of only conda-forge with strict channel priority (all pygplates dependencies are available on conda-forge, so this prevents mixing of channels).

conda config --add channels conda-forge
conda config --set channel_priority strict

Then I created a conda environment called pygplates_py38 to build pygplates with:

conda create --name pygplates_py38 python=3.8

…in your case your environment is called pygmt.

Then I activate the pygplates_py38 conda environment:

conda activate pygplates_py38

Then I install the pygplates dependencies:

conda install qt qwt cgal gdal boost proj zlib glew

Update: Also install cmake with conda install cmake. As noted in the post below this is needed on Ubuntu 18.04 (but was not needed on 20.04), but it’s a good idea to do this anyway.

Then I configure pygplates for compilation but instead of running cmake . as usual, I run:

cmake -DCMAKE_PREFIX_PATH:PATH=~/miniconda3/envs/pygplates_py38 .

…where ~/miniconda3 is where I installed MiniConda3 (the default location). The CMAKE_PREFIX_PATH tells CMake to look for dependencies in the conda environment first before looking in the standard Ubuntu system locations.

Then I compile pygplates:

make pygplates

Then I set the PYTHONPATH environment to the location of the pygplates.so just built (it’s in the bin sub-directory, but you can copy it elsewhere). Then when I run python in my activated environment I can then import pygplates.

By the way, we should have a conda package available for the next pyGPlates release so that you don’t need to install the dependencies or compile pygplates, instead just running conda install pygplates.