Can not install both gmt and cartopy because of conda dependency conflicts

I used to be able to install both gmt (v6.1.1) and cartopy (v0.18) using conda without any problems. However, about two days ago, dependency problems started to appear, and the only solution I found is to downgrade cartopy to v0.17. It doesn’t look like the conda-forge feedstocks have changed for either of these packages, so it’s not obvious to me what has changed. Cartopy and (py-)gmt are both popular packages for map projections, so it would be good to ensure that these can co-habitate together. Some python packages install both cartopy and gmt, so this is a major nuisance.

Here is the simplest way to reproduce this problem:

conda create -n test python=3.8 cartopy=0.18 gmt=6.1.1

and if you care, here is the long output describing the dependencies

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

Package python conflicts for:
cartopy=0.18 -> numpy[version='>=1.16.5,<2.0a0'] -> python[version='2.7.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.9,<3.10.0a0|3.4.*|>=3.5,<3.6.0a0|3.7.*|3.8.*|>=3.6|>=3']
python=3.8
gmt=6.1.1 -> gdal[version='>=3.0.4,<3.1.0a0'] -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0']
cartopy=0.18 -> python[version='>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0']

Package ncurses conflicts for:
python=3.8 -> readline[version='>=8.0,<9.0a0'] -> ncurses[version='5.9.*|>=6.2,<6.3.0a0|>=6.0,<7.0a0|6.0.*']
python=3.8 -> ncurses[version='>=6.1,<6.3.0a0|>=6.2,<7.0a0|>=6.1,<7.0a0']

Package python_abi conflicts for:
cartopy=0.18 -> numpy[version='>=1.16.5,<2.0a0'] -> python_abi[version='2.7.*|3.6|3.9.*',build='*_cp27m|*_cp39|*_pypy36_pp73']
cartopy=0.18 -> python_abi[version='3.6.*|3.7.*|3.8.*',build='*_cp38|*_cp37m|*_cp36m']

Package sqlite conflicts for:
cartopy=0.18 -> proj[version='>=7.1.1,<7.1.2.0a0'] -> sqlite[version='3.13.*|3.20.*|>=3.24.0,<4.0a0|>=3.25.2,<4.0a0|>=3.25.3,<4.0a0|>=3.26.0,<4.0a0|>=3.28.0,<4.0a0|>=3.30.1,<4.0a0|>=3.32.3,<4.0a0|>=3.33.0,<4.0a0|>=3.31.1,<4.0a0|>=3.29.0,<4.0a0|>=3.23.1,<4.0a0|>=3.22.0,<4.0a0|>=3.20.1,<4.0a0|>=3.25.1,<4.0a0|>=3.27.2,<4.0a0|>=3.30.0,<4.0a0']
python=3.8 -> sqlite[version='>=3.30.0,<4.0a0|>=3.30.1,<4.0a0|>=3.32.3,<4.0a0|>=3.33.0,<4.0a0|>=3.31.1,<4.0a0']

Package freetype conflicts for:
gmt=6.1.1 -> ffmpeg -> freetype[version='2.8.1|2.8.1.*|>=2.8.1,<2.8.2.0a0|>=2.8.1,<2.9.0a0|>=2.9.1,<3.0a0|>=2.8,<2.9.0a0']
cartopy=0.18 -> matplotlib-base[version='>=1.5.1'] -> freetype[version='2.5.*|2.6.*|2.7|2.7.*|2.7|2.8.*|2.8.1|2.8.1.*|>=2.10.2,<3.0a0|>=2.10.4,<3.0a0|>=2.9.1,<3.0a0|>=2.8.1,<2.9.0a0|>=2.10.3,<3.0a0|>=2.8,<2.9.0a0']

Package numpy conflicts for:
cartopy=0.18 -> numpy[version='>=1.14.6,<2.0a0|>=1.16.5,<2.0a0']
cartopy=0.18 -> shapely[version='>=1.5.6'] -> numpy[version='1.10.*|1.11.*|1.12.*|1.13.*|>=1.11|>=1.19.2,<2.0a0|>=1.9.3,<2.0a0|>=1.8|>=1.9|>=1.7|1.9.*|1.8.*|>=1.11.3,<2.0a0|>=1.14.1,<2.0a0|>=1.18.5,<2.0a0|>=1.15.4,<2.0a0|>=1.16.6,<2.0a0|>=1.18.1,<2.0a0|>=1.15.1,<2.0a0']

It’s possible that we need to rebuild the gmt feedstock as in

It looks like Cartopy rebuilt their feedstock for the automatic “Rebuild for gdal31” PR.

Perhaps someone could re-run the tests on the above gmt-PR to see if they now magically pass?

Tried to re-run that PR, but the bot deleted this PR automatically. Hopefully it will open another PR in the next few days.

It doesn’t look like the bot is going to rebuild this for us. What if we just update gdal to v3.1.3 in the feedstock and see if that works?

Do you want to open a PR for it?

I could try, but it might take 1 week (busy). I thought that this would just involve changing one version number in a single file, but looking at the old automatic PR that was closed, there were lots of other changes…

The bot reopened a new PR at https://github.com/conda-forge/gmt-feedstock/pull/111, but builds are still breaking :sweat_smile:

Thanks! Its working now (but not with python 3.9).

Cool, great to hear that it works!

About Python 3.9 support, we’re thinking about adding it to PyGMT in https://github.com/GenericMappingTools/pygmt/issues/644, but just curious to know if the rest of the ecosystem (Cartopy, matplotlib, etc) have Python 3.9 support already? If so then we should definitely get this sorted for PyGMT v0.2.1.

Edit: Started a PR for Python 3.9 support at https://github.com/GenericMappingTools/pygmt/pull/689 :smile: