Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a7e553d

Browse files
authored
Clarify that pycairo>=1.14.0 is needed. (#23843)
This is simply documenting the status quo and putting an earlier check for it (rather than erroring out with an AttributeError at runtime), so no changelog. Also, technically, only the gtk backends need pycairo 1.14 (the other backends can stick to 1.11), but 1.14 is old enough (2017) that it doesn't seem worth the complication of having two different bounds.
1 parent 959b2a0 commit a7e553d

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

doc/devel/dependencies.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,11 @@ and the capabilities they provide.
4747
most standard Python installations, but it's not part of Python itself and
4848
thus may not be present in rare cases.
4949
* PyQt6_ (>= 6.1), PySide6_, PyQt5_, or PySide2_: for the Qt-based backends.
50-
* PyGObject_: for the GTK-based backends. If using pip (but not conda or system
51-
package manager) PyGObject must be built from source; see `pygobject
52-
documentation
50+
* PyGObject_ and pycairo_ (>= 1.14.0): for the GTK-based backends. If using pip
51+
(but not conda or system package manager) PyGObject must be built from
52+
source; see `pygobject documentation
5353
<https://pygobject.readthedocs.io/en/latest/devguide/dev_environ.html>`_.
54-
* pycairo_ (>= 1.11.0) or cairocffi_ (>= 0.8): for the GTK and/or cairo-based
55-
backends.
54+
* pycairo_ (>= 1.14.0) or cairocffi_ (>= 0.8): for cairo-based backends.
5655
* wxPython_ (>= 4): for the wx-based backends. If using pip (but not conda or
5756
system package manager) on Linux wxPython wheels must be manually downloaded
5857
from https://wxpython.org/pages/downloads/.

lib/matplotlib/backends/backend_cairo.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414

1515
try:
1616
import cairo
17-
if cairo.version_info < (1, 11, 0):
18-
# Introduced create_for_data for Py3.
17+
if cairo.version_info < (1, 14, 0): # Introduced set_device_scale.
1918
raise ImportError
2019
except ImportError:
2120
try:
2221
import cairocffi as cairo
2322
except ImportError as err:
2423
raise ImportError(
25-
"cairo backend requires that pycairo>=1.11.0 or cairocffi "
24+
"cairo backend requires that pycairo>=1.14.0 or cairocffi "
2625
"is installed") from err
2726

2827
import matplotlib as mpl

0 commit comments

Comments
 (0)