# Cmake error while installing Pygplates

**URL:** https://discourse.gplates.org/t/cmake-error-while-installing-pygplates/351
**Category:** Q&A
**Created:** [28 July 2021 19:10 UTC](https://discourse.gplates.org/t/cmake-error-while-installing-pygplates/351 "2021-07-28T19:10:58Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![john.cannon](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@john.cannon](https://discourse.gplates.org/u/john.cannon)
#### Post date: [29 July 2021 06:06 UTC](https://discourse.gplates.org/t/cmake-error-while-installing-pygplates/351/3 "2021-07-29T06:06:08Z")

</div>

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).

```auto
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:

```auto
conda create --name pygplates_py38 python=3.8

```

…in your case your environment is called `pygmt`.

Then I activate the `pygplates_py38` conda environment:

```auto
conda activate pygplates_py38

```

Then I install the pygplates dependencies:

```auto
conda install qt qwt cgal gdal boost proj zlib glew

```

**Update** : Also install cmake with `conda install cmake`. As noted in the [post below](https://discourse.gplates.org/t/cmake-error-while-installing-pygplates/351/9) 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:

```auto
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:

```auto
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`.

---

_[View the full topic](https://discourse.gplates.org/t/cmake-error-while-installing-pygplates/351)._
