Kozea / CairoSVG

Convert your vector images
https://courtbouillon.org/cairosvg
GNU Lesser General Public License v3.0
762 stars 150 forks source link

Error on windows #329

Open vishalv26 opened 3 years ago

vishalv26 commented 3 years ago

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

liZe commented 3 years ago

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.

monicacue commented 2 years ago

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!

ScamCast commented 2 years ago

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

justingolden21 commented 2 years ago

No working for me in Windows

masoudMZB commented 1 year ago

same here

sildeag commented 1 year ago

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 commented 1 year ago

I think the above should close this issue.

liZe commented 1 year ago

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.