Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Commit3ecf087
committed
Fix
On Arch Linux, automatic backend selection fails when[`at-spi2-core`](https://archlinux.org/packages/extra/x86_64/at-spi2-core/files/)is installed but[`python-gobject`](https://archlinux.org/packages/extra/x86_64/python-gobject/files/)is not. Detect this by importign `gi.require_version` directly.```python>>> import matplotlib.pyplot as plt>>> plt.plot([0, 1], [0, 1])Traceback (most recent call last): File "<python-input-1>", line 1, in <module> plt.plot([0, 1], [0, 1]) ~~~~~~~~^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/matplotlib/pyplot.py", line 3838, in plot return gca().plot( ~~~^^ File "/usr/lib/python3.13/site-packages/matplotlib/pyplot.py", line 2785, in gca return gcf().gca() ~~~^^ File "/usr/lib/python3.13/site-packages/matplotlib/pyplot.py", line 1108, in gcf return figure() File "/usr/lib/python3.13/site-packages/matplotlib/pyplot.py", line 1042, in figure manager = new_figure_manager( num, figsize=figsize, dpi=dpi, facecolor=facecolor, edgecolor=edgecolor, frameon=frameon, FigureClass=FigureClass, **kwargs) File "/usr/lib/python3.13/site-packages/matplotlib/pyplot.py", line 551, in new_figure_manager _warn_if_gui_out_of_main_thread() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/usr/lib/python3.13/site-packages/matplotlib/pyplot.py", line 528, in _warn_if_gui_out_of_main_thread canvas_class = cast(type[FigureCanvasBase], _get_backend_mod().FigureCanvas) ~~~~~~~~~~~~~~~~^^ File "/usr/lib/python3.13/site-packages/matplotlib/pyplot.py", line 369, in _get_backend_mod switch_backend(rcParams._get("backend")) ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/matplotlib/pyplot.py", line 411, in switch_backend switch_backend(candidate) ~~~~~~~~~~~~~~^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/matplotlib/pyplot.py", line 425, in switch_backend module = backend_registry.load_backend_module(newbackend) File "/usr/lib/python3.13/site-packages/matplotlib/backends/registry.py", line 317, in load_backend_module return importlib.import_module(module_name) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^ File "/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module return _bootstrap._gcd_import(name[level:], package, level) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 1026, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/usr/lib/python3.13/site-packages/matplotlib/backends/backend_gtk4agg.py", line 4, in <module> from . import backend_agg, backend_gtk4 File "/usr/lib/python3.13/site-packages/matplotlib/backends/backend_gtk4.py", line 19, in <module> gi.require_version("Gtk", "4.0") ^^^^^^^^^^^^^^^^^^AttributeError: module 'gi' has no attribute 'require_version'```Fixes#30654.AttributeError: module 'gi' has no attribute 'require_version'1 parent9b61b47 commit3ecf087
2 files changed
+7
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
0 commit comments
Comments
(0)