TUFLOW Viewer Matplotlib Font Error

From Tuflow
Revision as of 22:03, 27 April 2023 by Ellis Symons (talk | contribs) (Created page with "This page describes how to fix TUFLOW Viewer if you get the following error (or similar). Unfortunately this is a bug with the plotting library TUFLOW Viewer uses (matplotlib)...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This page describes how to fix TUFLOW Viewer if you get the following error (or similar). Unfortunately this is a bug with the plotting library TUFLOW Viewer uses (matplotlib) and is due to an issue with its cached data.

ValueError: Failed to find font DejaVu Sans:style=normal:variant=normal:weight=normal:stretch=normal:size=10.0, and fallback to the default font was disabled

To fix this issue, the matplotlib cache data will need to be deleted. The steps below describe how to do this:

  1. Open QGIS
  2. Open the Python interpreter
    Qgis python interpreter tool button.PNG
  3. In the python interpreter type the following commands:
    import matplotlib
    print(matplotlib.get_cachedir())
    
    Qgis python interpreter mpl cache location.PNG
  4. This will print the matplotlib cache directory
  5. In this directory, delete the fontlist-v330.json file
    File explorer mpl cache location.PNG
  6. Try opening TUFLOW Viewer (you should not need to restart QGIS, however if it still doesn't work then restarting QGIS will be worth trying)