Win 7/Python 2.7 32bit: OSError: cannot load library pangocairo-1.0: error 0x7e
Asked Answered
A

2

7

I want to test weasyprint but it has a problem with the installation of pangocairo.

I successfully installed weasyprint:

pip install weasyprint

I installed gtk using this tutorial, downloading it from here.

I also set up the path to gtk\bin.

$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 208, in <module>
    'libpangocairo-1.0.so', 'libpangocairo-1.0.dylib')
  File "c:\root\python27\lib\site-packages\weasyprint\text.py", line 200, in dlopen
    return ffi.dlopen(names[0])  # pragma: no cover
  File "c:\root\python27\lib\site-packages\cffi\api.py", line 139, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File "c:\root\python27\lib\site-packages\cffi\api.py", line 769, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
  File "c:\root\python27\lib\site-packages\cffi\api.py", line 758, in _load_backend_lib
    return backend.load_library(name, flags)
OSError: cannot load library pangocairo-1.0: error 0x7e
Audreyaudri answered 2/7, 2016 at 15:1 Comment(0)
F
0

I was able to solve this issue by adding this dependency. Hope this works for you as well.

sudo apt-get install -y libpangocairo-1.0-0
Facture answered 4/8, 2022 at 15:34 Comment(0)
L
0

For Macos (M1)

even after brew install pango it shows the same error

pip uninstall weasyprint
pip install weasyprint

Hope it helps !

Lated answered 12/9, 2022 at 7:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.