-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed as not planned
Closed as not planned
Copy link
Description
Bug summary
matplotlib.get_backend()
will get stuck if DISPLAY
cannot be connected. Maybe should consider adding a timeout here.
matplotlib/src/_c_internal_utils.c
Lines 19 to 37 in 1b4b50b
if (getenv("DISPLAY") | |
&& (libX11 = dlopen("libX11.so.6", RTLD_LAZY))) { | |
struct Display* display = NULL; | |
struct Display* (* XOpenDisplay)(char const*) = | |
dlsym(libX11, "XOpenDisplay"); | |
int (* XCloseDisplay)(struct Display*) = | |
dlsym(libX11, "XCloseDisplay"); | |
if (XOpenDisplay && XCloseDisplay | |
&& (display = XOpenDisplay(NULL))) { | |
XCloseDisplay(display); | |
} | |
if (dlclose(libX11)) { | |
PyErr_SetString(PyExc_RuntimeError, dlerror()); | |
return NULL; | |
} | |
if (display) { | |
Py_RETURN_TRUE; | |
} | |
} |
Code for reproduction
import matplotlib
matplotlib.get_backend()
Actual outcome
get stuck
Expected outcome
return headless
if DISPLAY
cannot be connected
Additional information
No response
Operating system
No response
Matplotlib Version
3.7.3
Matplotlib Backend
No response
Python version
3.11.3
Jupyter version
No response
Installation
pip