CairoSVG icon indicating copy to clipboard operation
CairoSVG copied to clipboard

Error on windows

Open vishalv26 opened this issue 4 years ago • 8 comments

raise OSError(error_message) # pragma: no cover OSError: no library called "cairo" was found no library called "libcairo-2" was found cannot load library 'libcairo.so.2': error 0x7e cannot load library 'libcairo.2.dylib': error 0x7e cannot load library 'libcairo-2.dll': error 0x7e

vishalv26 avatar May 25 '21 11:05 vishalv26

Hello!

This error means that Cairo is not found on your system. The easiest way to install Cairo on Windows is to install GTK for Windows. You can also find links to useful issues in WeasyPrint’s documentation.

liZe avatar May 25 '21 13:05 liZe

Hi. I'm having the same problem. Also using Windows (WIndows 11 in my case). I already installed GTK using the link that you provided. I specifically downloaded this one: https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases/download/2022-01-04/gtk3-runtime-3.24.31-2022-01-04-ts-win64.exe

I also found that you respond the same question to another user called Project Dent. You sugested to use a virtual environment. I also try that and didn't work. Whenever I try to import cairovg in python it throws the same OS Error. The system cannot find Cairo.

github2

My question. How can I use Cairosvg (or Cairo) on Windows?

Thanks!

monicacue avatar Jan 24 '22 09:01 monicacue

Just wanted to say, I had this same issue on Windows. I ran the command prompt as Administrator and that fixed it.

ScamCast avatar Mar 30 '22 14:03 ScamCast

No working for me in Windows

justingolden21 avatar Apr 06 '22 01:04 justingolden21

same here

masoudMZB avatar Jan 28 '23 12:01 masoudMZB

When used in Python3.10 on Windows 11, it is not enough to add the GTK3-Runtime Win64 to the path as the dll still does not load correctly. Adding this solves the issue: gtkbin = r'C:\Program Files\GTK3-Runtime Win64\bin' add_dll_dir = getattr(os, 'add_dll_directory', None) if callable(add_dll_dir): add_dll_dir(gtkbin) else: os.environ['PATH'] = os.pathsep.join((gtkbin, os.environ['PATH'])) import cairosvg

sildeag avatar Mar 23 '23 21:03 sildeag

I think the above should close this issue.

sildeag avatar Mar 23 '23 21:03 sildeag

I think the above should close this issue.

If someone wants to open a PR with code that’s equivalent to what’s done in WeasyPrint, we will probably merge it.

liZe avatar Mar 23 '23 22:03 liZe