indico icon indicating copy to clipboard operation
indico copied to clipboard

Update install docs with libs (e.g. libpango) required by weasyprint

Open ThiefMaster opened this issue 1 year ago • 1 comments
trafficstars

The system libraries required by weasyprint are not installed by default on a typical server.

We need to mention in the docs (ideally after updating them to get rid of ancient stuff like centos7) what people have to install.

Alternatively (or additionally?) let's catch the failing import and maybe disable template creation if it cannot be imported due to missing libraries?

>>> import weasyprint

-----

WeasyPrint could not import some external libraries. Please carefully follow the installation steps before reporting an issue:
https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation
https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#troubleshooting

-----

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/indico/.venv/lib/python3.12/site-packages/weasyprint/__init__.py", line 387, in <module>
    from .css import preprocess_stylesheet  # noqa isort:skip
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/weasyprint/css/__init__.py", line 25, in <module>
    from . import computed_values, counters, media_queries
  File "/opt/indico/.venv/lib/python3.12/site-packages/weasyprint/css/computed_values.py", line 11, in <module>
    from ..text.ffi import ffi, pango, units_to_double
  File "/opt/indico/.venv/lib/python3.12/site-packages/weasyprint/text/ffi.py", line 431, in <module>
    pango = _dlopen(
            ^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/weasyprint/text/ffi.py", line 417, in _dlopen
    return ffi.dlopen(names[0])  # pragma: no cover
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/cffi/api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/cffi/api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/cffi/api.py", line 827, in _load_backend_lib
    raise OSError(msg)
OSError: cannot load library 'pango-1.0-0': pango-1.0-0: cannot open shared object file: No such file or directory.  Additionally, ctypes.util.find_library() did not manage to locate a library called 'pango-1.0-0'
>>>

ThiefMaster avatar Dec 12 '23 20:12 ThiefMaster

Looks like pango is the only required package - at least on alma9. Maybe some of its dependencies that get installed are required as well.

$ dnf install pango
Last metadata expiration check: 1:02:48 ago on Tue 12 Dec 2023 08:11:16 PM CET.
Dependencies resolved.
==============================================================================================================================================================
 Package                            Architecture                    Version                                  Repository                                  Size
==============================================================================================================================================================
Installing:
 pango                              x86_64                          1.48.7-3.el9                             AppStream-testing                          297 k
Installing dependencies:
 cairo                              x86_64                          1.17.4-7.el9                             AppStream-testing                          659 k
 fribidi                            x86_64                          1.0.10-6.el9.2                           AppStream-testing                           84 k
 libXft                             x86_64                          2.3.3-8.el9                              AppStream-testing                           61 k
 libdatrie                          x86_64                          0.2.13-4.el9                             AppStream-testing                           32 k
 libthai                            x86_64                          0.1.28-8.el9                             AppStream-testing                          208 k
 pixman                             x86_64                          0.40.0-5.el9                             AppStream-testing                          269 k

ThiefMaster avatar Dec 12 '23 20:12 ThiefMaster