-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Import hangs when matplotlib installed but no display available #6062
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What do you mean with "no display available"? You haven't installed matplotlib? |
Can you let us know your OS and Could be a bug of the |
I have matplotlib installed. Here's the output of Output of xr.show_versions()INSTALLED VERSIONScommit: None xarray: 0.19.0 By "no display available", I meant on a headless server (e.g. WSL2, compute node on slurm cluster). Digging more into this, this is related to matplotlib/matplotlib#17396 (matplotlib >= 3.4):
I experience hanging because my WSL2 setup sets DISPLAY to reference an X11 server that isn't always running. Since the X11 server is on Windows, the DISPLAY refers to a remote address. Apparently, X11 doesn't give up when it isn't able to connect to a remote X11 server, and, so it hangs on that command. That is for matplotlib >= 3.4. For matplotlib = 3.3 (which is still less than a year old) and xarray=0.20, I get:
This will become a little bit less of an issue when we set the minimum version of matplotlib to 3.4. However, I still think we should revert PR #5794 (PR #6064). It doesn't fix any bug. Before matplotlib >= 3.4, the common-knowledge I had previously seen from writing scripts with headless-use of matplotlib was that we shouldn't import |
What happened: On a device with no display available, importing xarray without setting the matplotlib backend hangs on import of matplotlib.pyplot since #5794 was merged.
What you expected to happen: I expect to be able to run
import xarray
without needing to mess with environment variables or import matplotlib and change the default backend.The text was updated successfully, but these errors were encountered: