'Cairo not found on Windows in GitHub Action

I'm trying to run my Python test suite in a GitHub Action on Ubuntu, macOS, and Windows, and the Windows version fails when I import the cairosvg library.

tests\test_svg_turtle.py:6: in <module>
    from cairosvg import svg2png
.tox\py\lib\site-packages\cairosvg\__init__.py:26: in <module>
    from . import surface  # noqa isort:skip
.tox\py\lib\site-packages\cairosvg\surface.py:9: in <module>
    import cairocffi as cairo
.tox\py\lib\site-packages\cairocffi\__init__.py:48: in <module>
    cairo = dlopen(
.tox\py\lib\site-packages\cairocffi\__init__.py:45: in dlopen
    raise OSError(error_message)  # pragma: no cover
E   OSError: no library called "cairo-2" was found
E   no library called "cairo" was found
E   no library called "libcairo-2" was found
E   cannot load library 'libcairo.so.2': error 0x7e
E   cannot load library 'libcairo.2.dylib': error 0x7e
E   cannot load library 'libcairo-2.dll': error 0x7e

The cairosvg documentation says that you need to install C++ and cairo. It suggests following the WeasyPrint documentation for more details. That says you need to install GTK3.

I haven't used Windows much with GitHub actions, so how do you install GTK3? Is that even what cairosvg needs?



Solution 1:[1]

I have installed cairo with the following command:

conda install -c conda-forge cairo

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 gremur