Closed gdementen closed 2 months ago
I am getting crazy over this one. I have been going back as far as matplotlib 3.3.4 (earliest version with conda package available for Python 3.9) and they all fail with the above error message, while my "dev38" environment which has matplotlib 3.7.2 works. I don't understand what else than matplotlib can change the available attributes.
Just when I thought I had found the most obscure bug of the year with #277. This one beats it hands down. The culprit seems to be an update to xlwings. I still have no idea how this can possibly have an impact on matplotlib structures, but with xlwings 0.24.x several of my environments work while with xlwings 0.31.4, they don't. I am curious to know what the **** is actually happening.
xlwings 0.29.1 works too
Found the culprit. xlwings 0.31.4 added this code:
import matplotlib as mpl
import matplotlib.figure # noqa: F401
import matplotlib.pyplot as plt
# https://matplotlib.org/stable/users/explain/figure/backends.html#static-backends
# This prevents "Starting a Matplotlib GUI outside of the main thread will likely
# fail." with xlwings Server
mpl.use("agg")
See: https://github.com/xlwings/xlwings/pull/2445
I guess we will need to set an explicit backend ourselves. Unsure it should be done before or after importing xlwings though.
Plots via Ctrl-P work fine, but the plot commands in the console are not displayed:
I suppose this is due to a matplotlib update. Sigh...
When running from within a script, we see the traceback: