Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CairoSVG not have surface #140

Closed
juwen opened this issue Feb 21, 2017 · 4 comments
Closed

CairoSVG not have surface #140

juwen opened this issue Feb 21, 2017 · 4 comments

Comments

@juwen
Copy link

juwen commented Feb 21, 2017

l installed CairoSVG 2.0.1(pip install CairoSVG).
and have Error:

Traceback (most recent call last):
  File "D:/work/lean_python/pdf/other.py", line 2, in <module>
    import cairosvg
  File "D:\env_python352\lib\site-packages\cairosvg\__init__.py", line 29, in <module>
    from . import surface
  File "D:\env_python352\lib\site-packages\cairosvg\surface.py", line 24, in <module>
    import cairocffi as cairo
  File "D:\env_python352\lib\site-packages\cairocffi\__init__.py", line 46, in <module>
    cairo = dlopen(ffi, 'cairo', 'cairo-2')
  File "D:\env_python352\lib\site-packages\cairocffi\__init__.py", line 43, in dlopen
    raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names))
OSError: dlopen() failed to load a library: cairo / cairo-2
@elzapp
Copy link

elzapp commented Feb 21, 2017

CairoSVG (the python library and bindings) needs Cairo (The C library, part of GTK+) to run. It appears you don't have it an it's headers installed on your system.

Judging by the paths in the traceback, I assume you are on windows. I'm not on windows currently, and haven't used Cairo on windows. But this article could be helpful:

https://blogs.gnome.org/nacho/2014/08/01/how-to-build-your-gtk-application-on-windows/
(it was referenced from here: https://www.gtk.org/download/windows.php)

@juwen
Copy link
Author

juwen commented Feb 21, 2017

Hi,elzapp
I have installed Cairo.
cairo.cairo_version_string() == 1.14.8
cairo.version == 1.10.0

@liZe
Copy link
Member

liZe commented Feb 21, 2017

Hi @juwen,

Installing Cairo on Windows and using it with Python can cause many problems, this bug is well known and has been reported many times.

Hopefully, there's a solution. You can carefully follow the steps of the WeasyPrint documentation, replacing python -m pip install weasyprint by python -m pip install cairosvg.

@liZe
Copy link
Member

liZe commented Mar 20, 2017

Can I close this issue, @juwen?

@liZe liZe closed this as completed Apr 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants