Weasyprint: Weasyprint 0.21 on Ubuntu 12.04 LTS 64 bit

Created on 29 Jan 2014  路  8Comments  路  Source: Kozea/WeasyPrint

Hi,

I'm running Weasyprint on OSX and Ubuntu12.04 32 bit without any problems and I have to say I think it's the best PDF lib out there.

I tried to install it on a 64 bit Ubuntu 12.04 production server also:

Deps:
apt-get install python-dev python-pip python-lxml libcairo2 libpango1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info

Then:
pip install WeasyPrint

No errors where reported and pip installed some stuff

When I try to run weasy print

Traceback (most recent call last):
  File "/usr/local/bin/weasyprint", line 9, in <module>
    load_entry_point('WeasyPrint==0.21', 'console_scripts', 'weasyprint')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 337, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2279, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1989, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/__init__.py", line 312, in <module>
    from .css import PARSER, preprocess_stylesheet
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/__init__.py", line 30, in <module>
    from . import computed_values
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/computed_values.py", line 18, in <module>
    from .. import text
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/text.py", line 204, in <module>
    pango = dlopen(ffi, 'pango-1.0', 'libpango-1.0-0')
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/text.py", line 200, in dlopen
    return ffi.dlopen(names[0])  # pragma: no cover
  File "/usr/local/lib/python2.7/dist-packages/cffi/api.py", line 117, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File "/usr/local/lib/python2.7/dist-packages/cffi/api.py", line 399, in _make_ffi_library
    backendlib = backend.load_library(name, flags)
OSError: cannot load library pango-1.0: pango-1.0: cannot open shared object file: No such file or directory

The pango lib is installed correctly and located in /usr/lib/x86_64-linux-gnu

Any help is appreciated.

Most helpful comment

I fixed it in ubuntu 14.04:
apt-get install pango1.0-tests

All 8 comments

The pango lib is installed correctly and located in /usr/lib/x86_64-linux-gnu

I find this surprising. Doesn鈥檛 APT packages install stuff directly in /usr/lib?

Anyway, try setting this environment variable: LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu, assuming that鈥檚 the directory containing a .so file for Pango.

I solved itself; So I think it had something to do with my environment. Maybe a logout/login was all it took after installing the deps...

Thanks for your swift reply (and this amazing PDF lib).

I have this problem how did you fix it?

Same here

I fixed it in ubuntu 14.04:
apt-get install pango1.0-tests

I fixed it in ubuntu 14.04:
apt-get install pango1.0-tests

It also solve Ubuntu 20.04 server.

It鈥檚 likely not the tests package that helps but its dependency libpango-1.0-0 or libpangocairo-1.0-0

Yes, thanks @SimonSapin . I just could not find that the package correct name was libpango-1.0-0 instead libpango1 like libcairo2 that I installed (solving the first part of the issue).

This is the better aproach: apt install libcairo2 libpango-1.0-0 libpangocairo-1.0-0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zopyx picture zopyx  路  5Comments

assuntaw picture assuntaw  路  3Comments

amarnav picture amarnav  路  5Comments

ajakubo1 picture ajakubo1  路  5Comments

knyttl picture knyttl  路  4Comments