Runtimeerror: cannot get window extent w/o rendere

2019-05-06 00:26发布

问题:

So I'm trying to get some stuff running with seaborn (specifically this example)

However when I run on normal ipython I get the runtime error listed in the title. It seems like a backend issue but I don't experience this with any other plotting utilities. Even stranger, if I run in the ipython notebook I no longer experience that error. I can certainly work with in the notebook for now and avoid problems but it's concerning that this happens in a terminal.

回答1:

This seems to be an issue with the MacOSX backend. It is tracked at matplotlib's issue tracker, but a fix apparently needs major rewriting and is not finished yet. (I guess related to this issue).

In the meantime switching the plotting backend is a workaround.

This can be done e.g. via command line by starting ipython with

ipython --matplotlib <your-favorite-backend>

Choosing an invalid backend (ipython --matplotlib ??) will print all available backends.

[TerminalIPythonApp] CRITICAL | Bad config encountered during initialization:
[TerminalIPythonApp] CRITICAL | The 'matplotlib' trait of a TerminalIPythonApp instance must be any of ['auto', 'gtk', 'gtk3', 'inline', 'nbagg', 'osx', 'qt', 'qt4', 'qt5', 'tk', 'wx'] or None, but a value of '??' <class 'str'> was specified.