Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Description
Bug summary
matplotlib.get_backend()
will get stuck ifDISPLAY
cannot be connected. Maybe should consider adding a timeout here.
matplotlib/src/_c_internal_utils.c
Lines 19 to 37 in1b4b50b
if (getenv("DISPLAY") | |
&& (libX11=dlopen("libX11.so.6",RTLD_LAZY))) { | |
structDisplay*display=NULL; | |
structDisplay* (*XOpenDisplay)(charconst*)= | |
dlsym(libX11,"XOpenDisplay"); | |
int (*XCloseDisplay)(structDisplay*)= | |
dlsym(libX11,"XCloseDisplay"); | |
if (XOpenDisplay&&XCloseDisplay | |
&& (display=XOpenDisplay(NULL))) { | |
XCloseDisplay(display); | |
} | |
if (dlclose(libX11)) { | |
PyErr_SetString(PyExc_RuntimeError,dlerror()); | |
returnNULL; | |
} | |
if (display) { | |
Py_RETURN_TRUE; | |
} | |
} |
Code for reproduction
importmatplotlibmatplotlib.get_backend()
Actual outcome
get stuck
Expected outcome
returnheadless
ifDISPLAY
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