cartopy: Minimizing incompatibility between cartopy and shapely

Cartopy has a module that both imports Shapely and adds new GEOS bindings: https://github.com/SciTools/cartopy/blob/master/lib/cartopy/trace.pyx. I think this is an unsound approach that can lead innocent cartopy users into DLL Hell.

I’d like to propose two better approaches.

Move all of cartopy’s GEOS dependency into Shapely

The extension code in trace.pyx is rather small and could be moved to Shapely and deleted from cartopy. The DLL Hellmouth would be closed and cartopy users could benefit from binary Shapely wheels. There’s still time to do this before Shapely 1.6.0.

Vendorize Shapely

Cartopy could copy the Shapely source and add build steps for it into setup.py, removing it from the list of dependencies that would be resolved by pip or setuptools. The internal copy of Shapely would be built using the same geos_c as cartopy’s trace module and the DLL Hellmouth would thus be closed.

@QuLogic @pelson I see in other tickets here that conda is what you’re focusing on. Neither of my proposed approaches are need for conda, though moving the extension code into Shapely will have the benefit of removing calls into Shapely’s private internal API and thus making cartopy more forward compatible with Shapely. I think that’s probably the better approach for making pip install cartopy work on OS X.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 40 (29 by maintainers)

Commits related to this issue

Most upvoted comments

We have just released v0.22 which should help with the compatibility between packages and installation much easier. Please open a new issue if you are still having problems.

After the release of shapely 1.8.2, I encountered a tricky issue outlined here. I found that downgrading shapely to 1.8.0 solves the problem. I think this issue here describes the core problem. There are some ideas in this conversation since a long time regarding how this could be solved. I wonder if anyone works on this?