chemtools icon indicating copy to clipboard operation
chemtools copied to clipboard

Matplotlib backend configuration

Open tovrstra opened this issue 5 years ago • 3 comments

In some scenario's (not sure which), usage of matplotlib on macos with the default backend leads to non-obvious errors. See for example:

https://travis-ci.com/theochem/tinydft/jobs/200737929#L297 https://github.com/theochem/tinydft/issues/1

This is solved in chemtools with the following line:

https://github.com/theochem/chemtools/blob/b899469657d7f6c85a5def55c38918ea502309b5/chemtools/outputs/plot.py#L27

The problem with this solution is that it makes it impossible to use plt.show to pop up a windows with a plot.

The ideal solution would be to figure out how to install matplotlib on macos, such that the default backend works.

This is the corresponding matplotlib issue: https://github.com/matplotlib/matplotlib/issues/13096 (It is closed??)

This is the corresponding conda issue: https://github.com/ContinuumIO/anaconda-issues/issues/10554

tovrstra avatar May 22 '19 08:05 tovrstra

The problem is fixed in matplotlib-3.1.0, which is at this time not available yet on conda.

tovrstra avatar May 22 '19 09:05 tovrstra

Essentially, the line matplotlib.use('agg') can be removed from chemtools. It would be better for end users not to have it. Just keep in mind that travis and others need to be configured to run with the agg backend, e.g. as is done here:

https://github.com/theochem/tinydft/blob/master/.roberto.yaml#L27-L29

tovrstra avatar May 22 '19 09:05 tovrstra

Matplotlib in conda just got updated to 3.1.0, so the default backend should be fine again for conda users.

tovrstra avatar May 31 '19 14:05 tovrstra