orzih / mkdocs-with-pdf

Generate a single PDF file from MkDocs repository.
MIT License
338 stars 78 forks source link

OSError: no library called "cairo" was found #72

Open qiuqiufrank opened 3 years ago

qiuqiufrank commented 3 years ago

enviroment: Windows10, Python3.9.5 cmd: mkdocs.exe build error:

return _process_result(sub_ctx.command.invoke(sub_ctx))

File "d:\hzh_sfq\projects\shenzhen\docs\venv\lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, *ctx.params) File "d:\hzh_sfq\projects\shenzhen\docs\venv\lib\site-packages\click\core.py", line 763, in invoke return __callback(args, kwargs) File "d:\hzh_sfq\projects\shenzhen\docs\venv\lib\site-packages\mkdocs__main__.py", line 183, in build_command build.build(config.load_config(kwargs), dirty=not clean) File "d:\hzh_sfq\projects\shenzhen\docs\venv\lib\site-packages\mkdocs\commands\build.py", line 249, in build config = config['plugins'].run_event('config', config) File "d:\hzh_sfq\projects\shenzhen\docs\venv\lib\site-packages\mkdocs\plugins.py", line 94, in run_event result = method(item, **kwargs) File "d:\hzh_sfq\projects\shenzhen\docs\venv\lib\site-packages\mkdocs_pdf_export_plugin\plugin.py", line 42, in on_config from .renderer import Renderer File "d:\hzh_sfq\projects\shenzhen\docs\venv\lib\site-packages\mkdocs_pdf_export_plugin\renderer.py", line 6, in from weasyprint import HTML File "d:\hzh_sfq\projects\shenzhen\docs\venv\lib\site-packages\weasyprint__init.py", line 469, in from .css import preprocess_stylesheet # noqa isort:skip File "d:\hzh_sfq\projects\shenzhen\docs\venv\lib\site-packages\weasyprint\css__init.py", line 27, in from . import computed_values, counters, media_queries File "d:\hzh_sfq\projects\shenzhen\docs\venv\lib\site-packages\weasyprint\css\computed_values.py", line 15, in from .. import text File "d:\hzh_sfq\projects\shenzhen\docs\venv\lib\site-packages\weasyprint\text.py", line 11, in import cairocffi as cairo File "d:\hzh_sfq\projects\shenzhen\docs\venv\lib\site-packages\cairocffi\init__.py", line 48, in cairo = dlopen( File "d:\hzh_sfq\projects\shenzhen\docs\venv\lib\site-packages\cairocffi\init__.py", line 45, in dlopen raise OSError(error_message) # pragma: no cover OSError: no library called "cairo" was found no library called "libcairo-2" was found cannot load library 'libcairo.so.2': error 0x7e cannot load library 'libcairo.2.dylib': error 0x7e cannot load library 'libcairo-2.dll': error 0x7e

qiuqiufrank commented 3 years ago

How to solve this problem?

orzih commented 3 years ago

This seems to be an EasyPrint issue. Please check Weasy print document.

pchinery commented 2 years ago

I had a similar issue (with lib gobject.so.2) and it was because weasyprint requires a GTK3 runtime which needs to be installed on Windows: https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer

After installing, it worked fine and it might be the same reason here.