cannot load library 'gobject-2.0-0'

See original GitHub issue

Hello, I’ve tried every troubleshooting option for this. I use a mac M1 and My project is in a pip wrapper environment. I’ve installed all required packages with homebrew. and I still get this error. is there a way to fix this that I am missing?

Watching for file changes with StatReloader
INFO 2021-11-02 07:24:18,683 autoreload 2663 8642752000 Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/django/utils/autoreload.py", line 53, in wrapper
    fn(*args, **kwargs)
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
    self.check(display_num_errors=True)
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/django/core/management/base.py", line 392, in check
    all_issues = checks.run_checks(
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/django/core/checks/registry.py", line 70, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
    all_namespaces = _load_all_namespaces(resolver)
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
    url_patterns = getattr(resolver, 'url_patterns', [])
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/django/urls/resolvers.py", line 589, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/django/urls/resolvers.py", line 582, in urlconf_module
    return import_module(self.urlconf_name)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/lancemeister/PycharmProjects/music_meister_shop/musicmeister/config/urls.py", line 21, in <module>
    path("orders/", include("musicmeister.orders.urls", namespace="orders")),
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/lancemeister/PycharmProjects/music_meister_shop/musicmeister/musicmeister/orders/urls.py", line 3, in <module>
    from musicmeister.orders import views
  File "/Users/lancemeister/PycharmProjects/music_meister_shop/musicmeister/musicmeister/orders/views.py", line 13, in <module>
    from weasyprint import HTML, CSS
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/weasyprint/__init__.py", line 322, in <module>
    from .css import preprocess_stylesheet  # noqa isort:skip
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/weasyprint/css/__init__.py", line 27, in <module>
    from . import computed_values, counters, media_queries
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/weasyprint/css/computed_values.py", line 16, in <module>
    from ..text.ffi import ffi, pango, units_to_double
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/weasyprint/text/ffi.py", line 380, in <module>
    gobject = _dlopen(
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/weasyprint/text/ffi.py", line 377, in _dlopen
    return ffi.dlopen(names[0])  # pragma: no cover
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/cffi/api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/cffi/api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
  File "/Users/lancemeister/.virtualenvs/music_meister_shop/lib/python3.9/site-packages/cffi/api.py", line 827, in _load_backend_lib
    raise OSError(msg)
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'

Issue Analytics

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

github_iconTop GitHub Comments

7reactions
liZecommented, Nov 2, 2021

Wow, using virtrualenvwrapper on top of virtualenv on top of venv, installed by Anaconda on top of Homebrew… Python virtual environments are definitely a mess!

Here’s what I’d do, and what you should do if it’s possible:

  • Remove Anaconda from Homebrew. Having one unofficial package manager on top of macOS is already a mess, having a package manager in a package manager is a crazy idea 😉.
  • Unset VIRTUALENVWRAPPER_PYTHON and VIRTUALENVWRAPPER_VIRTUALENV, as they’re handled by Hombrew’s virtualenvwrapper.
  • Install WeasyPrint’s dependencies in Homebrew.
  • Install Homebrew’s virtualenvwrapper (if you really want to use virtualenvwrapper).
  • Check that virtualenvwrapper.sh is the one installed by Homebrew (using which virtualenvwrapper.sh).
  • Launch source virtualenvwrapper.sh.
  • Remove any virtualenv related to your project from $HOME/.virtualenvs, and recreate them.

Don’t hesitate to ask if there’s anything you don’t fully understand, or if you can’t do this for some reason.

1reaction
pymeistercommented, Nov 2, 2021

hi, @liZe followed your instructions exactly and I’m happy to say problem solved. Thank you for helping me clear up that mess of virtualenv’s that I had. Thank You, Thank You 🙌. everything is now working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OSError: cannot load library 'gobject-2.0': error 0x7e. #971
As always when it comes to "OSError cannot load library" on Windows it's a matter of PATH resp. the os.path that Python presents...
Read more >
OSError: cannot load library 'gobject-2.0': error 0x7e
Starting from Python 3.8 DLL dependencies for extension modules and DLLs loaded with ctypes on Windows are now resolved more securely.
Read more >
OSError: cannot load library 'gobject-2.0': error 0x7e-django
I got desperate and decided to install the library gtk2 C:\Program Files (x86)\GTK2\lib\ and specify the first in the PATH list.
Read more >
OSError: cannot load library 'gobject-2.0': error 0x7e - 七牛云
我很绝望,决定安装gtk2库 C:\Program Files (x86)\GTK2\lib\ 并在PATH列表中指定第一个。它成功了...但是我的操作系统- Win 10 x64。为什么GTK3库拒绝工作,我不知道。
Read more >
Gobject-2.0-0.dll Download - DLL 4 Free
The file gobject-2.0-0.dll is a 32bit Windows DLL module for GLib or other related programs. The file is also referred as libgobject-2.0-.dll. The...
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