Error when plotting maps with cartopy

I’m hitting a fatal ‘Oh no’ error whenever I try to plot a map with cartopy, using either the matplotlib or Bokeh (through geoviews) plotting elements. Plotting without a projection works fine but means I can’t add coastlines or other geographic information.

I’ve installed the necessary libgeos libraries but the fact I don’t get a python stack suggests it could be a C library incompatibility or memory issue.

The app is here:

And the code is here: GitHub - duncanwp/climatebench-app

Any help / advice would be much appreciated!

Hi @duncanwp,

Here’s a graph of the app’s memory usage over the past month:

In terms of errors, I see the following:

Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.10/site-packages/streamlit/runtime/legacy_caching/", line 590, in get_or_create_cached_value
    return_value = _read_from_cache(
  File "/home/appuser/venv/lib/python3.10/site-packages/streamlit/runtime/legacy_caching/", line 350, in _read_from_cache
    raise e
  File "/home/appuser/venv/lib/python3.10/site-packages/streamlit/runtime/legacy_caching/", line 335, in _read_from_cache
    return _read_from_mem_cache(
  File "/home/appuser/venv/lib/python3.10/site-packages/streamlit/runtime/legacy_caching/", line 252, in _read_from_mem_cache
    raise CacheKeyNotFoundError("Key not found in mem cache")
streamlit.runtime.legacy_caching.caching.CacheKeyNotFoundError: Key not found in mem cache
Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/", line 564, in _run_script
    exec(code, module.__dict__)
  File "/app/climatebench-app/", line 151, in <module>
  File "/app/climatebench-app/", line 88, in main
    temperature, uncertainty = climatebench_gp(co2, ch4, so2, bc)
  File "/app/climatebench-app/", line 130, in climatebench_gp
    model = load_model("climatebench_webapp")
  File "/home/appuser/venv/lib/python3.10/site-packages/streamlit/runtime/legacy_caching/", line 624, in wrapped_func
    return get_or_create_cached_value()
  File "/home/appuser/venv/lib/python3.10/site-packages/streamlit/runtime/legacy_caching/", line 608, in get_or_create_cached_value
    return_value = non_optional_func(*args, **kwargs)
  File "/app/climatebench-app/", line 128, in load_model
    loaded_model = tf.saved_model.load(model_path)
  File "/home/appuser/venv/lib/python3.10/site-packages/tensorflow/python/saved_model/", line 828, in load
    result = load_partial(export_dir, None, tags, options)["root"]
  File "/home/appuser/venv/lib/python3.10/site-packages/tensorflow/python/saved_model/", line 933, in load_partial
  File "/home/appuser/venv/lib/python3.10/site-packages/tensorflow/python/saved_model/", line 57, in parse_saved_model_with_debug_info
    saved_model = parse_saved_model(export_dir)
  File "/home/appuser/venv/lib/python3.10/site-packages/tensorflow/python/saved_model/", line 115, in parse_saved_model
    raise IOError(
OSError: SavedModel file does not exist at: climatebench_webapp/{saved_model.pbtxt|saved_model.pb}