torchdrug icon indicating copy to clipboard operation
torchdrug copied to clipboard

`import torchdrug` will result in GUI of matplotlib use agg

Open DreamMemory001 opened this issue 4 years ago • 2 comments

import torchdrug will result in GUI of matplotlib use agg and the figure cant show. In general, the GUI of matplotlib use module://backend_interaggto show figure. Agg is non-GUI backend, so please tell why? In the graph.py, i find the function named visualize to show figure, but i cant find why change it. Hope to get your reply! Thanks!

Tip: I find a solution to solve this problem. under the all import, add matplotlib.use('module://backend_interagg') and import matplotlib.

DreamMemory001 avatar Aug 20 '21 13:08 DreamMemory001

Hi! Sorry for the inconvenience. TorchDrug was mainly developed on non-GUI Linux servers, and agg is a compatible choice for non-GUI machines. We presume the most use of GUI is in Jupyter Notebook. In that case, %matplotlib inline is always required and there is nothing complaining about agg.

We will try to find a better solution that accommodate all machines. Do you have any idea which backend is the most compatible?

KiddoZhu avatar Aug 20 '21 15:08 KiddoZhu

if using jupyter notebook or jupyter lab, add the command %matplotlib inline after "from torchdrug import data" maybe useful.

yrq3027 avatar Aug 26 '21 07:08 yrq3027