14

I'm trying to run a simple Cartopy example:

   import cartopy.crs as ccrs
   import matplotlib.pyplot as plt
   ax = plt.axes(projection=ccrs.PlateCarree())
   ax.coastlines()
   plt.show()

But I'm getting this error:

Geometry must be a Point or LineString
python: geos_ts_c.cpp:4179: int GEOSCoordSeq_getSize_r(GEOSContextHandle_t, const geos::geom::CoordinateSequence*, unsigned int*): Assertion0 != cs' failed`.

I installed Cartopy using miniconda3: conda install -c conda-forge cartopy I also tried to install Cartopy with pip (in a virtual environment), but I get the same error. My OS is Debian Buster.

Any idea?

1 Answer 1

29

The problem is a wrong version of shapely, with Cartopy the binary package shoudn't be used, it should be built from source instead. This is explained here and here.

So I did:

pip uninstall shapely
pip install shapely --no-binary shapely
1
  • Thanks! so my Colab command was: !pip uninstall -y shapely !pip install shapely --no-binary shapely Mar 14, 2022 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.