PHAREHUB/PHARE

build fails if TKinter is missing (it should be optional)

Closed this issue · 3 comments

Some python scripts are run during build to generate somethings used later in testing.

solution is

import matplotlib
matplotlib.use("Agg")  # for systems without GUI

error

Traceback (most recent call last):
  File "/path/to/phare/tests/amr/data/field/coarsening/test_coarsen_field.py", line 14, in <module>
    from pyphare.pharesee.hierarchy import FieldData
  File "/path/to/phare/pyphare/pyphare/pharesee/hierarchy.py", line 11, in <module>
    import matplotlib.pyplot as plt
  File "/home/deegan/.local/lib/python3.9/site-packages/matplotlib/pyplot.py", line 2500, in <module>
    switch_backend(rcParams["backend"])
  File "/home/deegan/.local/lib/python3.9/site-packages/matplotlib/pyplot.py", line 285, in switch_backend
    raise ImportError(
ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running

could you be more specific about the context in which you got this error?

this is during cmake config generating test data

it's possible we want to move the import of pyplot

work around is available

export MPLBACKEND=TKAgg

reference

more of an env issue anyway