Getting "OSError: dlopen() failed to load a library: cairo / cairo-2" on Windows

I got following error message: OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2, on Windows 10.

The GTK+ libraries which contain the libraries above can be obtained and installed from https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer, as documented on https://weasyprint.readthedocs.io/en/latest/install.html#gtk64installer.

Note that your development environment will need to be restarted to read PATH.


See http://win32builder.gnome.org/ or http://gtk-win.sourceforge.net/home/ for a list of GTK+ bundles to install. These include the required cairo/cairo-2 libs.

  • Extract the contents of the bin\ folder to e.g. C:\Program Files (x86)\GTK2-bundle\ (any directory would do)
  • Add the above directory to your PATH environment variable
  • Restart your development environment (in my case PyCharm)