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

Weasyprint fails on Windows 7/Python 2.7.x #330

Closed
ChameleonRed opened this issue Jul 2, 2016 · 8 comments
Closed

Weasyprint fails on Windows 7/Python 2.7.x #330

ChameleonRed opened this issue Jul 2, 2016 · 8 comments
Milestone

Comments

@ChameleonRed
Copy link

ChameleonRed commented Jul 2, 2016

Python 2.7.x
GTK+ Ash (last version)

Why cairo2 not want to load?

$weasyprint
Traceback (most recent call last):
  File "c:\root\python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\root\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "c:\root\python27\scripts\weasyprint.exe\__main__.py", line 5, in <module>
  File "c:\root\python27\lib\site-packages\weasyprint\__init__.py", line 336, in <module>
    from .css import PARSER, preprocess_stylesheet  # noqa
  File "c:\root\python27\lib\site-packages\weasyprint\css\__init__.py", line 30, in <module>
    from . import computed_values
  File "c:\root\python27\lib\site-packages\weasyprint\css\computed_values.py", line 18, in <module>
    from .. import text
  File "c:\root\python27\lib\site-packages\weasyprint\text.py", line 18, in <module>
    import cairocffi as cairo
  File "c:\root\python27\lib\site-packages\cairocffi\__init__.py", line 46, in <module>
    cairo = dlopen(ffi, 'cairo', 'cairo-2')
  File "c:\root\python27\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
@jbouclier
Copy link

jbouclier commented Jul 23, 2016

I did need to add the path to GTK installation before running weasyprint.

Have you tried run it like this?

@set PATH=C:\path_to_your_installation\lib;%PATH%
weasyprint

@ChameleonRed
Copy link
Author

I added GTK path and not works - GTK explained in documentation. I can try it with different version of GTK - I am using currently Python 2.7 - maybe I need to use Python 3. It takes some weeks until will be time to do it.

@liZe
Copy link
Member

liZe commented Jul 25, 2016

@jbouclier @ChameleonRed I've written a small list of instructions to make WeasyPrint work on Windows. Could you try it?

@jbouclier
Copy link

jbouclier commented Jul 25, 2016

@ChameleonRed

I'm using Python 2.7.11 (64bits) for windows together with GTK2 (64bits) I downloaded from here:

https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer

May be there are some other dependencies on native libraries, like the C++ compiler @liZe mentions. Is hard for me to tell. I did the installation in a development machine. I lost track what I installed there and why.

@liZe
Copy link
Member

liZe commented Jul 28, 2016

When trying to install random GTK versions (for example mixing 64 bit Python with 32 bit GTK), I've met this error, but it works with the new instructions. I close the bug for now, @ChameleonRed feel free to re-open it if needed.

@liZe liZe closed this as completed Jul 28, 2016
@liZe liZe modified the milestone: v0.31 Aug 26, 2016
@cmaliwal
Copy link

cmaliwal commented Sep 30, 2017

I am also getting same error in my window 8 python 2.7.13.
I uninstalled flask_weasyprint and again installed but isuue not resolved.

@liZe
Copy link
Member

liZe commented Sep 30, 2017

@cmaliwal Reinstalling flask_weasyprint is not enough. You can uninstall and reinstall Python and GTK carefully following the steps described in the documentation.

@akash1551
Copy link

@ChameleonRed This might help you,

sudo apt-get install libcairo2 libpango1.0-0

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

5 participants