WeasyPrint: Weasyprint startup error after updating to El Capitan (OS X 10.11)

I recently updated my OS on my mac to El Capitan and since then have been running into issues trying to run WeasyPrint. I have updated macports, uninstalled and reinstalled all of the macport dependencies. I’ve also uninstalled and reinstalled WeasyPrint via pip with no issues, but still it doesn’t run. I also have the export DYLD_FALLBACK_LIBRARY_PATH="/opt/local/lib" in my ~/.profile which helped solve the import errors and allowed WeasyPrint to run before I had El Capitan installed. When i type weasyprint --help into the terminal i get the following output/error:

 File "main.py", line 14, in <module>
    import nextline_webapp.quotes                   # pylint: disable=unused-import
  File "/Users/joshsacks/NextLine/nextline_webapp/quotes.py", line 8, in <module>
    from flask_weasyprint import HTML, render_pdf
  File "/Library/Python/2.7/site-packages/flask_weasyprint/__init__.py", line 13, in <module>
    import weasyprint
  File "/Library/Python/2.7/site-packages/weasyprint/__init__.py", line 336, in <module>
    from .css import PARSER, preprocess_stylesheet
  File "/Library/Python/2.7/site-packages/weasyprint/css/__init__.py", line 30, in <module>
    from . import computed_values
  File "/Library/Python/2.7/site-packages/weasyprint/css/computed_values.py", line 18, in <module>
    from .. import text
  File "/Library/Python/2.7/site-packages/weasyprint/text.py", line 18, in <module>
    import cairocffi as cairo
  File "/Library/Python/2.7/site-packages/cairocffi/__init__.py", line 46, in <module>
    cairo = dlopen(ffi, 'cairo', 'cairo-2')
  File "/Library/Python/2.7/site-packages/cairocffi/__init__.py", line 43, in dlopen
    raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names))
OSError: dlopen() failed to load a library: cairo / cairo-2

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 24 (11 by maintainers)

Most upvoted comments

I also experience the problem on a fresh install of weasyprint on Mac 10.11.6. I use macports thus all the solutions involving brew are not helpful.

I installed sudo port install cairo after pip install weasyprint. I’m using Python 3.5.2

Seems like conda install pango helped.

Same here. Just installed WeasyPrint on an El Capitan install that has not had WeasyPrint on it before or been upgraded from previous OSX installs. Error I get is:

raise OSError(“dlopen() failed to load a library: %s” % ’ / '.join(names)) OSError: dlopen() failed to load a library: cairo / cairo-2