Skip to content

Problem (and solution) with weasyprint and GTK+3 for Windows 10 pro #166

Description

@fftgit

While installing weasyprint on my windows 10 pro computer, I followed the instructions here :
https://doc.courtbouillon.org/weasyprint/stable/first_steps.html

But the last command python -m weasyprint --info returned an error (beware that this command can also be python3 -m weasyprint --info depending on your Python installation, which is v3.11 for me by the way)
"WeasyPrint could not import some external libraries."

And the output log displayed in the end :

…/…
OSError: cannot load library 'gobject-2.0-0': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'gobject-2.0-0'

The (undocumented) solution is that GTK+3, needed for weasyprint to work (https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases) does not install this library with this name but instead 'libgobject-2.0-0.dll' in the folder (by default) : C:\Program Files\GTK3-Runtime Win64\bin\

So the only thing to do is to copy libgobject-2.0-0.dll in the same folder, and rename it to gobject-2.0-0.dll, restart your computer (important) and it will work !

# python -m weasyprint --info
WeasyPrint version: 59.0
Python version: 3.11.4
Pydyf version: 0.7.0
Pango version: 15003

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions