question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot load library 'pango-1.0-0': pango-1.0-0 issue

See original GitHub issue

I got this error suddenly and not sure why, it was working perfectly earlier I was using django-weasyprint previously I removed it and used weasyprint then on my Dockerfile I added this.

# Install apt packages
RUN apt-get update && apt-get install --no-install-recommends -y \
  # dependencies for building Python packages
  build-essential \
  # psycopg2 dependencies
  libpq-dev \
  # WeasyPrint dependencies
  libpango-1.0-0 \
  libharfbuzz0b \
  libpangoft2-1.0-0

Previous I have this on my Dockerfile

  # WeasyPrint dependencies
  libcairo2 \
  libpango-1.0-0 \
  libpangocairo-1.0-0 \
  libgdk-pixbuf2.0-0 \
  libffi-dev \
  shared-mime-info

Error from the console

water_conservation_docs | Traceback (most recent call last):
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/sphinx/config.py", line 327, in eval_config_file
water_conservation_docs |     execfile_(filename, namespace)
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/sphinx/util/pycompat.py", line 88, in execfile_
water_conservation_docs |     exec(code, _globals)
water_conservation_docs |   File "/docs/conf.py", line 27, in <module>
water_conservation_docs |     django.setup()
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
water_conservation_docs |     apps.populate(settings.INSTALLED_APPS)
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/django/apps/registry.py", line 122, in populate
water_conservation_docs |     app_config.ready()
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/django/contrib/admin/apps.py", line 24, in ready
water_conservation_docs |     self.module.autodiscover()
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/django/contrib/admin/__init__.py", line 24, in autodiscover
water_conservation_docs |     autodiscover_modules('admin', register_to=site)
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/django/utils/module_loading.py", line 47, in autodiscover_modules
water_conservation_docs |     import_module('%s.%s' % (app_config.name, module_to_search))
water_conservation_docs |   File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
water_conservation_docs |     return _bootstrap._gcd_import(name[level:], package, level)
water_conservation_docs |   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
water_conservation_docs |   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
water_conservation_docs |   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
water_conservation_docs |   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
water_conservation_docs |   File "<frozen importlib._bootstrap_external>", line 848, in exec_module
water_conservation_docs |   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
water_conservation_docs |   File "/app/water_conservation_api/core/admin.py", line 16, in <module>
water_conservation_docs |     from water_conservation_api.core.services import OrganizationService
water_conservation_docs |   File "/app/water_conservation_api/core/services.py", line 27, in <module>
water_conservation_docs |     from water_conservation_api.core.tasks import (
water_conservation_docs |   File "/app/water_conservation_api/core/tasks.py", line 17, in <module>
water_conservation_docs |     from water_conservation_api.utils.helpers import generate_pdf, send_job_notification
water_conservation_docs |   File "/app/water_conservation_api/utils/helpers.py", line 9, in <module>
water_conservation_docs |     from weasyprint import HTML
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/weasyprint/__init__.py", line 322, in <module>
water_conservation_docs |     from .css import preprocess_stylesheet  # noqa isort:skip
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/weasyprint/css/__init__.py", line 27, in <module>
water_conservation_docs |     from . import computed_values, counters, media_queries
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/weasyprint/css/computed_values.py", line 16, in <module>
water_conservation_docs |     from ..text.ffi import ffi, pango, units_to_double
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/weasyprint/text/ffi.py", line 383, in <module>
water_conservation_docs |     pango = _dlopen(
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/weasyprint/text/ffi.py", line 377, in _dlopen
water_conservation_docs |     return ffi.dlopen(names[0])  # pragma: no cover
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/cffi/api.py", line 150, in dlopen
water_conservation_docs |     lib, function_cache = _make_ffi_library(self, name, flags)
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/cffi/api.py", line 832, in _make_ffi_library
water_conservation_docs |     backendlib = _load_backend_lib(backend, libname, flags)
water_conservation_docs |   File "/usr/local/lib/python3.8/site-packages/cffi/api.py", line 827, in _load_backend_lib
water_conservation_docs |     raise OSError(msg)
water_conservation_docs | 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'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
aabanaagcommented, Aug 23, 2021

Thank you for pointing it to a better path. I’ll close this one since this is not really an issue for WeasyPrint

0reactions
liZecommented, Aug 22, 2021

As explained earlier, this error is probably caused by environment variables removed or modified by cookiecutter, or Sphinx, or Django. Your Docker instance works when you call WeasyPrint, but it doesn’t when you use these tools, so…

You can try to use WeasyPrint with only Django, and see if it works. You can then try with Sphinx, and then with cookiecutter until you get the error. When you know which tool changes the environment variables, it will be easier to find a solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OSError: cannot load library 'pango-1.0-0' · Issue #14 - GitHub
OSError: cannot load library 'pango-1.0-0' #14. Closed. JulieYue2021 opened this issue on Dec 9, 2021 · 5 comments.
Read more >
ctypes.util.find_library() did not manage to locate a library ...
... the problem. sudo apt-get install -y libpangocairo-1.0-0 ... For mac, I just installed pango using homebrew and it seemed to work.
Read more >
Solved - weasyprint | The FreeBSD Forums
Here, without using pip, a test result, problem-free: 1634860923488.png ... cannot load library 'pango-1.0-0': pango-1.0-0 issue.
Read more >
Repair Pango-1.0.dll DLL Issues (How to Download and Fix)
pango -1.0.dll errors are related to problems with Camtasia 2019 Dynamic Link Library (DLL) files. Generally, DLL errors are caused by ...
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 >

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