Mac M1 OSError: cannot load library 'gobject-2.0-0'

See original GitHub issue

Hello! I could install WeasyPrint==53.3 on my M1 mac.

But when importing

from weasyprint import HTML, CSS

I receive an error

OSError: cannot load library 'gobject-2.0-0': dlopen(gobject-2.0-0, 2): image not found.  
Additionally, ctypes.util.find_library() did not manage to locate a library called 'gobject-2.0-0'

Was anyone able to handle this? šŸ¤”

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

22reactions
MikhailKravetscommented, Sep 23, 2021

Hi @liZe , thanks for the reply. The problem was that symlinks to the libraries were not created (can’t say should it be done by homebrew or weasyprint when installation) šŸ™ˆ .

So, I had to create symlinks to these libs manually

sudo ln -s /opt/homebrew/opt/glib/lib/libgobject-2.0.0.dylib /usr/local/lib/gobject-2.0
sudo ln -s /opt/homebrew/opt/pango/lib/libpango-1.0.dylib /usr/local/lib/pango-1.0
sudo ln -s /opt/homebrew/opt/harfbuzz/lib/libharfbuzz.dylib /usr/local/lib/harfbuzz
sudo ln -s /opt/homebrew/opt/fontconfig/lib/libfontconfig.1.dylib /usr/local/lib/fontconfig-1
sudo ln -s /opt/homebrew/opt/pango/lib/libpangoft2-1.0.dylib /usr/local/lib/pangoft2-1.0

This solved the problem šŸ‘

1reaction
liZecommented, Sep 23, 2021

I’ve installed Python3.9 with the installer.

That’s why you get this error. You can either uninstall this version of Python installed with the installer and use the Hombrew version instead (that’s the ā€œofficialā€ solution according to the documentation), or keep the symlinks if you prefer (and hope that everything will be fine after the next upgrade).

Read more comments on GitHub >

github_iconTop Results From Across the Web

gobject-2.0-0 not able to load on macbook - Stack Overflow
I just managed the same issue on my Mac M1. The problem was that symlinks to the libraries were not created (can't say...
Read more >
[Example code]-gobject-2.0-0 not able to load on macbook
I am facing this error when I start my flask python3 application on mac. OSError: cannot load library 'gobject-2.0-0': dlopen(gobject-2.0-0, 2): image notĀ ......
Read more >
[Solved] MacBook (M1 chip) OSError: no library called cairo ...
OSError : no library called "cairo-2" was found. Cannot load library 'pango-1.0'
Read more >
What's new in the updates for macOS Big Sur - Apple Support
macOS Big Sur 11.6.7 fixes an issue where Mail and apps, such as Microsoft Outlook, cannot open attachments if the app required to...
Read more >
M1 mac: mach-o file, but is an incompatible architecture (have ...
same question for almost all the python package, why Apple did not test anything? – DunkOnly. Dec 9 at 9:32. Add a commentĀ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found