Search code examples
matplotlibcartopy

How to deal with segmentation fault when running samples from cartopy documentation?


On running any of cartopy examples (or any code for plotting purpose using pyplot and cartopy) system returns Segmentation fault

I have already tried the solution listed here: Cartopy examples produce a Segmentation fault

pip uninstall shapely
pip install --no-binary :all: shapely

When I tried running this basic example:

import cartopy.crs as ccrs
import matplotlib.pyplot as plt

ax = plt.axes(projection=ccrs.PlateCarree())
ax.coastlines()

plt.show()

This is the log:

(python:19052): Gtk-WARNING **: 21:40:45.891: Theme parsing error: gtk.css:11546:3: '/*' in comment block

(python:19052): Gtk-WARNING **: 21:40:45.891: Theme parsing error: gtk.css:11652:2: '/*' in comment block
Segmentation fault (core dumped)

Solution

  • I found the answer in this issue: https://github.com/SciTools/cartopy/issues/738

    So I just had to uninstall both cartopy and shapely, and then use:

    pip install shapely cartopy --no-binary shapely --no-binary cartopy