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

1👍

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.

👤SaeX

5👍

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)
👤SaeX

0👍

I had same problem on windows X64/Python37 but i fixed with bellow link:

follow this steps : https://weasyprint.readthedocs.io/en/stable/install.html#windows,
(i installed gtk with MSYS Installer and added C:\msys64\mingw32\bin to PATH variable,after that i occurred with same error and i deleted cairocffi python library and reinstall it)

Leave a comment