Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

How to make a map!

# TODO update cartopy
import numpy as np
import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
pd.options.display.max_columns = 25
#To use cartopy in a Colab notebook, I need a particular sequence of installs (as shown at this notebook: https://colab.research.google.com/github/adamlamee/CODINGinK12/blob/master/notebooks/quakes.ipynb#scrollTo=3LkZkXvnMAr4)
# %apt-get -qq install python-cartopy python3-cartopy;
%pip install cartopy
%pip uninstall -y shapely;
#TODO unable to install shapely
%pip install shapely --no-binary shapely;
import cartopy.crs as ccrs
import cartopy.feature as cfeature
from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter
Requirement already satisfied: cartopy in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (0.25.0)
Requirement already satisfied: numpy>=1.23 in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from cartopy) (2.4.1)
Requirement already satisfied: matplotlib>=3.6 in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from cartopy) (3.10.8)
Collecting shapely>=2.0 (from cartopy)
  Using cached shapely-2.1.2-cp312-cp312-macosx_11_0_arm64.whl.metadata (6.8 kB)
Requirement already satisfied: packaging>=21 in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from cartopy) (25.0)
Requirement already satisfied: pyshp>=2.3 in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from cartopy) (3.0.3)
Requirement already satisfied: pyproj>=3.3.1 in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from cartopy) (3.7.2)
Requirement already satisfied: contourpy>=1.0.1 in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from matplotlib>=3.6->cartopy) (1.3.3)
Requirement already satisfied: cycler>=0.10 in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from matplotlib>=3.6->cartopy) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from matplotlib>=3.6->cartopy) (4.61.1)
Requirement already satisfied: kiwisolver>=1.3.1 in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from matplotlib>=3.6->cartopy) (1.4.9)
Requirement already satisfied: pillow>=8 in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from matplotlib>=3.6->cartopy) (12.1.0)
Requirement already satisfied: pyparsing>=3 in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from matplotlib>=3.6->cartopy) (3.3.1)
Requirement already satisfied: python-dateutil>=2.7 in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from matplotlib>=3.6->cartopy) (2.9.0.post0)
Requirement already satisfied: certifi in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from pyproj>=3.3.1->cartopy) (2026.1.4)
Requirement already satisfied: six>=1.5 in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from python-dateutil>=2.7->matplotlib>=3.6->cartopy) (1.17.0)
Using cached shapely-2.1.2-cp312-cp312-macosx_11_0_arm64.whl (1.6 MB)
Installing collected packages: shapely
Successfully installed shapely-2.1.2

[notice] A new release of pip is available: 24.0 -> 26.0
[notice] To update, run: pip3 install --upgrade pip
Note: you may need to restart the kernel to use updated packages.
Found existing installation: shapely 2.1.2
Uninstalling shapely-2.1.2:
  Successfully uninstalled shapely-2.1.2
Note: you may need to restart the kernel to use updated packages.
Collecting shapely
  Using cached shapely-2.1.2.tar.gz (315 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.21 in /Users/sbessey/Documents/riddc-jbook/.venv/lib/python3.12/site-packages (from shapely) (2.4.1)
Building wheels for collected packages: shapely
  Building wheel for shapely (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for shapely (pyproject.toml) did not run successfully.
   exit code: 1
  ╰─> [192 lines of output]
      Could not find geos-config executable. Either append the path to geos-config to PATH or manually provide the include_dirs, library_dirs, libraries and other link args for compiling against a GEOS version >=3.9.
      /private/var/folders/2t/c4g4q9mn0h7_clctmngctpn00000gq/T/pip-build-env-9ly4xvz5/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:82: SetuptoolsDeprecationWarning: `project.license` as a TOML table is deprecated
      !!
      
              ********************************************************************************
              Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`. (Both options available on setuptools>=77.0.0).
      
              By 2027-Feb-18, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.
      
              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************
      
      !!
        corresp(dist, value, root_dir)
      /private/var/folders/2t/c4g4q9mn0h7_clctmngctpn00000gq/T/pip-build-env-9ly4xvz5/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:61: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!
      
              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:
      
              License :: OSI Approved :: BSD License
      
              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************
      
      !!
        dist._finalize_license_expression()
      /private/var/folders/2t/c4g4q9mn0h7_clctmngctpn00000gq/T/pip-build-env-9ly4xvz5/overlay/lib/python3.12/site-packages/setuptools/dist.py:765: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!
      
              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:
      
              License :: OSI Approved :: BSD License
      
              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************
      
      !!
        self._finalize_license_expression()
      running bdist_wheel
      running build
      running build_py
      creating build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/conftest.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/predicates.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/_enum.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/creation.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/strtree.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/coords.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/_version.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/prepared.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/linear.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/_coverage.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/plotting.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/io.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/measurement.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/affinity.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/__init__.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/ops.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/_geometry.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/set_operations.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/geos.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/wkt.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/errors.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/speedups.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/testing.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/constructive.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/_ragged_array.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/wkb.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/coordinates.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/validation.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/decorators.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      creating build/lib.macosx-14.0-arm64-cpython-312/shapely/algorithms
      copying shapely/algorithms/_oriented_envelope.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/algorithms
      copying shapely/algorithms/__init__.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/algorithms
      copying shapely/algorithms/polylabel.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/algorithms
      copying shapely/algorithms/cga.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/algorithms
      creating build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_constructive.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_strtree.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_plotting.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_coverage.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_decorators.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_misc.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_measurement.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_set_operations.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/__init__.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_io.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_creation.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_ragged_array.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/common.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_coordinates.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_predicates.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_linear.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_geometry.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_creation_indices.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      copying shapely/tests/test_testing.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests
      creating build/lib.macosx-14.0-arm64-cpython-312/shapely/vectorized
      copying shapely/vectorized/__init__.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/vectorized
      creating build/lib.macosx-14.0-arm64-cpython-312/shapely/geometry
      copying shapely/geometry/geo.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/geometry
      copying shapely/geometry/multilinestring.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/geometry
      copying shapely/geometry/multipolygon.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/geometry
      copying shapely/geometry/polygon.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/geometry
      copying shapely/geometry/linestring.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/geometry
      copying shapely/geometry/multipoint.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/geometry
      copying shapely/geometry/__init__.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/geometry
      copying shapely/geometry/point.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/geometry
      copying shapely/geometry/collection.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/geometry
      copying shapely/geometry/base.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/geometry
      creating build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_prepared.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_split.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/conftest.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_transform.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_products_z.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_substring.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_empty_polygons.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_validation.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_delaunay.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_affinity.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_buffer.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_polygonize.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_locale.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_shape.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_pickle.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/threading_test.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_make_valid.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_operations.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_singularity.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_parallel_offset.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_box.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_operators.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/__init__.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_snap.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_persist.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_orient.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_ndarrays.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_union.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_voronoi_diagram.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_linear_referencing.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_cga.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_geointerface.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_create_inconsistent_dimensionality.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_wkb.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_shared_paths.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_clip_by_rect.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_linemerge.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_predicates.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_invalid_geometries.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_polylabel.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_equality.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_svg.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_nearest.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_minimum_clearance.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_wkt.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_vectorized.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      copying shapely/tests/legacy/test_mapping.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/legacy
      creating build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_emptiness.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_point.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_decimal.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/__init__.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_collection.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_polygon.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_multipolygon.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_hash.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_linestring.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_multipoint.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_coords.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_geometry_base.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_equality.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_multi.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_multilinestring.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/tests/geometry/test_format.py -> build/lib.macosx-14.0-arm64-cpython-312/shapely/tests/geometry
      copying shapely/_geos.pxd -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      copying shapely/_pygeos_api.pxd -> build/lib.macosx-14.0-arm64-cpython-312/shapely
      UPDATING build/lib.macosx-14.0-arm64-cpython-312/shapely/_version.py
      set build/lib.macosx-14.0-arm64-cpython-312/shapely/_version.py to '2.1.2'
      running build_ext
      building 'shapely.lib' extension
      creating build/temp.macosx-14.0-arm64-cpython-312/src
      clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -I/Users/sbessey/Documents/riddc-jbook/.venv/include -I/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c src/c_api.c -o build/temp.macosx-14.0-arm64-cpython-312/src/c_api.o
      In file included from src/c_api.c:14:
      In file included from src/c_api.h:22:
      src/geos.h:5:10: fatal error: 'numpy/ndarraytypes.h' file not found
          5 | #include <numpy/ndarraytypes.h>
            |          ^~~~~~~~~~~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for shapely
Failed to build shapely
ERROR: Could not build wheels for shapely, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 24.0 -> 26.0
[notice] To update, run: pip3 install --upgrade pip
Note: you may need to restart the kernel to use updated packages.
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[2], line 12
     10 get_ipython().run_line_magic('pip', 'uninstall -y shapely;')
     11 get_ipython().run_line_magic('pip', 'install shapely --no-binary shapely;')
---> 12 import cartopy.crs as ccrs
     13 import cartopy.feature as cfeature
     14 from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter

File ~/Documents/riddc-jbook/.venv/lib/python3.12/site-packages/cartopy/__init__.py:106
    102     pass
    104 # Commonly used sub-modules. Imported here to provide end-user
    105 # convenience.
--> 106 import cartopy.crs  # noqa: E402  module-level imports
    107 import cartopy.feature  # noqa: E402,F401  (unused import)

File ~/Documents/riddc-jbook/.venv/lib/python3.12/site-packages/cartopy/crs.py:24
     22 from pyproj import Transformer
     23 from pyproj.exceptions import ProjError
---> 24 import shapely
     25 import shapely.geometry as sgeom
     26 from shapely.prepared import prep

ModuleNotFoundError: No module named 'shapely'
fig, ax = plt.subplots(figsize=(12,7))
ax = plt.axes(projection=ccrs.PlateCarree())
ax.coastlines(resolution='10m')
ax.set_extent([-72.75, -69.75, 40.5, 42.25])
<Figure size 864x504 with 1 Axes>