Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weasyprint startup error after updating to El Capitan (OS X 10.11) #277

Closed
SirNeuman opened this issue Nov 4, 2015 · 24 comments
Closed
Labels
crash Problems preventing documents from being rendered

Comments

@SirNeuman
Copy link

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

@SimonSapin
Copy link
Member

Sigh :( I hear over and over from people with this kind of issue, but I still have no idea what the cause is. Here is a reduced program with many fewer moving parts than all of WeasyPrint + cairocffi:

from cffi import FFI
import ctypes.util
FFI().dlopen(ctypes.util.find_library('cairo') + '')

(Note: + '' is a trick to make the program fail when find_library returns None.)

If you find some variation of it (skip find_library, add a "lib" prefix to the name, use the .dylib actual filename, …) that does not raise an exception, then maybe we can fix cairocffi to do something similar. If not, there might be a problem with your cairo install. But I can’t really help with that, I don’t use OS X myself.

@SirNeuman
Copy link
Author

Ok so I found a solution (without changing any of the original weasyprint or cairocffi files). Apparently OS X 10.11 introduces SIP which disables the use of DYLD path variables. To get around this I disabled SIP. The instructions to do so are here. Basically hold command + r when booting up. Click utilities at the top and go into the terminal. type in csrutil disable then reboot and that should fix it.

@SimonSapin
Copy link
Member

“Disable that security feature of your OS to use WeasyPrint” doesn’t sound great :/

@SirNeuman
Copy link
Author

no its not. for me this is only a temporary solution. There must be another way around using the DYLD path in order to be able to load cairo into Weasyprint/Cairocffi. I mean the reason we have to use that is just because MacPorts and PIP install to two different locations right?

@SimonSapin
Copy link
Member

pip is not really involved. It’s about where macports installes dynamic libraries and how the dlopen() operating system call can find them. I don’t know what the conventions and configurations are on OS X.

@superzazu
Copy link

Hello,

I had a similar problem today, and even though it's not exactly the same error; I think it'd be helpful to post how I fixed it. Note that I installed weasyprint before (when I was using OS X 10.10) via brew.

Here's the error :

OSError: cannot load library /usr/local/lib/libpangocairo-1.0.dylib: dlopen(/usr/local/lib/libpangocairo-1.0.dylib, 2): Library not loaded: /usr/local/lib/libharfbuzz.0.dylib
  Referenced from: /usr/local/lib/libpangocairo-1.0.dylib

That's almost the same problem (a lib not found), but it concerned a different file "libharfbuzz.0.dylib". I noticed the package "harfbuzz" was already installed by brew (in /usr/local/Cellar/harfbuzz); so I just fixed it doing :

brew link harfbuzz

By default, brew installs packages in /usr/local/Cellar and add some symlinks in /usr/local. It seems that the symlinks disappeared sometime during the update to OS X 10.11 ?

(maybe use brew install cairo ?)

@liZe
Copy link
Member

liZe commented Mar 8, 2016

Does anyone have a problem on OSX with a fresh installation, or is it just OSX/brew randomly removing files?

@liZe liZe added the crash Problems preventing documents from being rendered label Mar 8, 2016
@liZe
Copy link
Member

liZe commented Jul 28, 2016

No news is good news.

@liZe liZe closed this as completed Jul 28, 2016
@evilangel-ru
Copy link

Hi, i have same problem with fresh installation of WeasyPrint on MacOS 10.11.6. Disabling a SIP doesn't work for me. If somebody have some other solution?

@iainctduncan
Copy link

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

@liZe liZe reopened this Sep 12, 2016
@liZe
Copy link
Member

liZe commented Sep 12, 2016

You can find on Stack Overflow that reinstalling Python could help.

You can also try to uninstall and reinstall cairocffi, that's my random solution for today.

Various other links:

@anuragjain
Copy link

anuragjain commented Sep 23, 2016

Hello,
I am having the same issue on fresh installation of weasyprint on OSX

import weasyprint
Traceback (most recent call last):
File "", line 1, in
File "/Users/anurag/VirtualEnvs/stitchwood_website/lib/python2.7/site-packages/weasyprint/init.py", line 338, in
from .css import PARSER, preprocess_stylesheet # noqa
File "/Users/anurag/VirtualEnvs/stitchwood_website/lib/python2.7/site-packages/weasyprint/css/init.py", line 30, in
from . import computed_values
File "/Users/anurag/VirtualEnvs/stitchwood_website/lib/python2.7/site-packages/weasyprint/css/computed_values.py", line 18, in
from .. import text
File "/Users/anurag/VirtualEnvs/stitchwood_website/lib/python2.7/site-packages/weasyprint/text.py", line 18, in
import cairocffi as cairo
File "/Users/anurag/VirtualEnvs/stitchwood_website/lib/python2.7/site-packages/cairocffi/init.py", line 46, in
cairo = dlopen(ffi, 'cairo', 'cairo-2')
File "/Users/anurag/VirtualEnvs/stitchwood_website/lib/python2.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

And I don't want to disable SIP as some answers were suggesting on stack overflow, tried installing and uninstalling but it didn't help.
Any solution for this will be really helpful.

@anuragjain
Copy link

I managed to solve this issue, have posted the full details here http://stackoverflow.com/a/39674220/1957136

I hope someone else also find it helpful

@alecjacobson
Copy link

I'm running into this same problem today using brew then pip to try to install on Mac OS X. The solution from @anuragjain on stackoverflow does not seem to be universal.

libcairo.2.dylib,libcairo.a,libcairo.dylib all exist in /usr/local/lib which should be found during dynamic linking.

@pkgandhi
Copy link

Hi @anuragjain - This solution didn't work for windows. Is there a way around this specifically for windows?

@liZe
Copy link
Member

liZe commented Nov 13, 2016

Is there a way around this specifically for windows?

On Windows, following the docs should work. Install only 64 bits packages (Python, Cairo, etc.) on Windows 64 bits or you'll kill kittens.

@pkgandhi
Copy link

Thanks @liZe. I have 3.5 version. Will this work with that too?

@liZe
Copy link
Member

liZe commented Nov 14, 2016

I have 3.5 version. Will this work with that too?

You can try, you'll have to find the Visual C++ compiler for Python 3.5.

@drorata
Copy link

drorata commented Nov 29, 2016

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.

@liZe
Copy link
Member

liZe commented Mar 25, 2017

MacOS installation is now tested on Travis, strictly following the documentation steps. Does anyone has a problem now when following these steps?

@liZe
Copy link
Member

liZe commented Nov 19, 2017

Closing, last comment is 1 year old.

@liZe liZe closed this as completed Nov 19, 2017
@alecjacobson
Copy link

I'm still failing to install weasyprint on Mac OS following the official instructions. I get a bunch of warnings that might be helpful to deduce what's wrong:

brew install python3 cairo pango gdk-pixbuf libffi

produces

==> Installing dependencies for python: gdbm, openssl, readline, sqlite
==> Installing python dependency: gdbm
==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.18.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gdbm-1.18.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/gdbm/1.18: 20 files, 584.4KB
==> Installing python dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2p.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2p.high_sierra.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

For pkg-config to find openssl you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/openssl/1.0.2p: 1,793 files, 12.3MB
==> Installing python dependency: readline
==> Downloading https://homebrew.bintray.com/bottles/readline-7.0.5.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring readline-7.0.5.high_sierra.bottle.tar.gz
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

For compilers to find readline you may need to set:
  export LDFLAGS="-L/usr/local/opt/readline/lib"
  export CPPFLAGS="-I/usr/local/opt/readline/include"

==> Summary
🍺  /usr/local/Cellar/readline/7.0.5: 46 files, 1.5MB
==> Installing python dependency: sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.25.1.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring sqlite-3.25.1.high_sierra.bottle.tar.gz
==> Caveats
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.

If you need to have sqlite first in your PATH run:
  echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profile

For compilers to find sqlite you may need to set:
  export LDFLAGS="-L/usr/local/opt/sqlite/lib"
  export CPPFLAGS="-I/usr/local/opt/sqlite/include"

For pkg-config to find sqlite you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/sqlite/3.25.1: 11 files, 3.7MB
==> Installing python
==> Downloading https://homebrew.bintray.com/bottles/python-3.7.0.high_sierra.bottle.5.tar.gz
######################################################################## 100.0%
==> Pouring python-3.7.0.high_sierra.bottle.5.tar.gz
==> /usr/local/Cellar/python/3.7.0/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/3.7.0/bin --ins
==> /usr/local/Cellar/python/3.7.0/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/3.7.0/bin --ins
==> /usr/local/Cellar/python/3.7.0/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/3.7.0/bin --ins
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run
  brew install python@2

Pip, setuptools, and wheel have been installed. To update them run
  pip3 install --upgrade pip setuptools wheel

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺  /usr/local/Cellar/python/3.7.0: 4,790 files, 102.2MB
==> Installing dependencies for cairo: libffi, glib
==> Installing cairo dependency: libffi
==> Downloading https://homebrew.bintray.com/bottles/libffi-3.2.1.high_sierra.bottle.tar.gz
Already downloaded: /Users/ajx/Library/Caches/Homebrew/downloads/2b94fcbd05c57dd780b931b4889951260b361d368dd3be9c8a38cb2c6e310fcc--libffi-3.2.1.high_sierra.bottle.tar.gz
==> Pouring libffi-3.2.1.high_sierra.bottle.tar.gz
==> Caveats
libffi is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.

For compilers to find libffi you may need to set:
  export LDFLAGS="-L/usr/local/opt/libffi/lib"

For pkg-config to find libffi you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/libffi/3.2.1: 16 files, 297.0KB
==> Installing cairo dependency: glib
==> Downloading https://homebrew.bintray.com/bottles/glib-2.58.1.high_sierra.bottle.tar.gz
Already downloaded: /Users/ajx/Library/Caches/Homebrew/downloads/793d6ad4819532e35187b565a9b1b9c6b5742efe630950e261b23286824d635a--glib-2.58.1.high_sierra.bottle.tar.gz
==> Pouring glib-2.58.1.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/glib/2.58.1: 435 files, 18.4MB
==> Installing cairo
==> Downloading https://homebrew.bintray.com/bottles/cairo-1.14.12.high_sierra.bottle.tar.gz
Already downloaded: /Users/ajx/Library/Caches/Homebrew/downloads/6e3b6a0ff53613735ff63bdd716a9993122ab1876186f1a4446566dad760f4d7--cairo-1.14.12.high_sierra.bottle.tar.gz
==> Pouring cairo-1.14.12.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/cairo/1.14.12: 118 files, 5.8MB
==> Installing dependencies for pango: harfbuzz
==> Installing pango dependency: harfbuzz
==> Downloading https://homebrew.bintray.com/bottles/harfbuzz-1.9.0.high_sierra.bottle.tar.gz
Already downloaded: /Users/ajx/Library/Caches/Homebrew/downloads/a3e3c1d715c5bedef6829003365157fdc20d0f3b3154b34ae5236c97d68518fd--harfbuzz-1.9.0.high_sierra.bottle.tar.gz
==> Pouring harfbuzz-1.9.0.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/harfbuzz/1.9.0: 148 files, 6.3MB
==> Installing pango
==> Downloading https://homebrew.bintray.com/bottles/pango-1.42.4.high_sierra.bottle.tar.gz
Already downloaded: /Users/ajx/Library/Caches/Homebrew/downloads/c0077c94fb44c51f0e2b1e700256f686525792f0556256bce94de5011e19e8bc--pango-1.42.4.high_sierra.bottle.tar.gz
==> Pouring pango-1.42.4.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/pango/1.42.4: 106 files, 4.3MB
==> Downloading https://homebrew.bintray.com/bottles/gdk-pixbuf-2.38.0.high_sierra.bottle.tar.gz
Already downloaded: /Users/ajx/Library/Caches/Homebrew/downloads/d34aa093020b750e08a905040db9353f8560438d24b55b7f634f540838548ef5--gdk-pixbuf-2.38.0.high_sierra.bottle.tar.gz
==> Pouring gdk-pixbuf-2.38.0.high_sierra.bottle.tar.gz
==> /usr/local/Cellar/gdk-pixbuf/2.38.0/bin/gdk-pixbuf-query-loaders --update-cache
🍺  /usr/local/Cellar/gdk-pixbuf/2.38.0: 147 files, 3.2MB
==> Caveats
==> openssl
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

For pkg-config to find openssl you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

==> readline
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

For compilers to find readline you may need to set:
  export LDFLAGS="-L/usr/local/opt/readline/lib"
  export CPPFLAGS="-I/usr/local/opt/readline/include"

==> sqlite
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.

If you need to have sqlite first in your PATH run:
  echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profile

For compilers to find sqlite you may need to set:
  export LDFLAGS="-L/usr/local/opt/sqlite/lib"
  export CPPFLAGS="-I/usr/local/opt/sqlite/include"

For pkg-config to find sqlite you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"

==> python
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run
  brew install python@2

Pip, setuptools, and wheel have been installed. To update them run
  pip3 install --upgrade pip setuptools wheel

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> libffi
libffi is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.

For compilers to find libffi you may need to set:
  export LDFLAGS="-L/usr/local/opt/libffi/lib"

For pkg-config to find libffi you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

and

 pip3 install weasyprint

produces

Collecting weasyprint
  Using cached https://files.pythonhosted.org/packages/a5/3c/a7021bea33ef7515901d77b11cb0d356171068055591e9d813962a0092d8/WeasyPrint-0.42.3-py3-none-any.whl
Collecting tinycss2>=0.5 (from weasyprint)
  Using cached https://files.pythonhosted.org/packages/88/95/0ec73db7fc638ec000e662936ffe1a4e1eaa22f2861c8de18b1597c42584/tinycss2-0.6.1-py2.py3-none-any.whl
Collecting cairocffi>=0.5 (from weasyprint)
  Using cached https://files.pythonhosted.org/packages/62/be/ad4d422b6f38d99b09ad6d046ab725e8ccac5fefd9ca256ca35a80dbf3c6/cairocffi-0.9.0.tar.gz
Collecting pdfrw>=0.4 (from weasyprint)
  Using cached https://files.pythonhosted.org/packages/c0/84/af442c4458756bb0c0d2424102d1200616f3ff9b82c48aaa130e08549bf6/pdfrw-0.4-py2.py3-none-any.whl
Collecting html5lib>=0.999999999 (from weasyprint)
  Using cached https://files.pythonhosted.org/packages/a5/62/bbd2be0e7943ec8504b517e62bab011b4946e1258842bc159e5dfde15b96/html5lib-1.0.1-py2.py3-none-any.whl
Collecting Pyphen>=0.8 (from weasyprint)
  Using cached https://files.pythonhosted.org/packages/15/82/08a3629dce8d1f3d91db843bb36d4d7db6b6269d5067259613a0d5c8a9db/Pyphen-0.9.5-py2.py3-none-any.whl
Collecting CairoSVG>=1.0.20; python_version >= "3.0" (from weasyprint)
  Using cached https://files.pythonhosted.org/packages/db/8c/eb114f08b0db43ec05c946e33d1a180819f34c185f05223407ac9a6fce90/CairoSVG-2.1.3-py3-none-any.whl
Collecting cssselect2>=0.1 (from weasyprint)
  Using cached https://files.pythonhosted.org/packages/12/e2/91fcd4cd32545beec6e11628d64d3e20f11b5a95dd1ccf3216fd69f176b7/cssselect2-0.2.1-py2.py3-none-any.whl
Collecting cffi>=0.6 (from weasyprint)
  Downloading https://files.pythonhosted.org/packages/0b/ba/32835c9965d8a0090723e1d0b47373365525c4bd08c807b5efdc9fecbc99/cffi-1.11.5-cp37-cp37m-macosx_10_9_x86_64.whl (163kB)
    100% |████████████████████████████████| 163kB 3.5MB/s 
Collecting webencodings>=0.4 (from tinycss2>=0.5->weasyprint)
  Using cached https://files.pythonhosted.org/packages/f4/24/2a3e3df732393fed8b3ebf2ec078f05546de641fe1b667ee316ec1dcf3b7/webencodings-0.5.1-py2.py3-none-any.whl
Collecting six>=1.9 (from html5lib>=0.999999999->weasyprint)
  Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting pillow (from CairoSVG>=1.0.20; python_version >= "3.0"->weasyprint)
  Downloading https://files.pythonhosted.org/packages/8d/50/362dc2580ae2539331768c0c3295730c791d79216c9a271114022e8c9895/Pillow-5.2.0-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.6MB)
    100% |████████████████████████████████| 3.6MB 4.8MB/s 
Collecting defusedxml (from CairoSVG>=1.0.20; python_version >= "3.0"->weasyprint)
  Using cached https://files.pythonhosted.org/packages/87/1c/17f3e3935a913dfe2a5ca85fa5ccbef366bfd82eb318b1f75dadbf0affca/defusedxml-0.5.0-py2.py3-none-any.whl
Collecting pycparser (from cffi>=0.6->weasyprint)
Building wheels for collected packages: cairocffi
  Running setup.py bdist_wheel for cairocffi ... done
  Stored in directory: /Users/ajx/Library/Caches/pip/wheels/3a/2e/92/89e9dcce600a1a78bebe571fdd096669cba354b29c5e1140b9
Successfully built cairocffi
Installing collected packages: webencodings, tinycss2, pycparser, cffi, cairocffi, pdfrw, six, html5lib, Pyphen, pillow, cssselect2, defusedxml, CairoSVG, weasyprint
Successfully installed CairoSVG-2.1.3 Pyphen-0.9.5 cairocffi-0.9.0 cffi-1.11.5 cssselect2-0.2.1 defusedxml-0.5.0 html5lib-1.0.1 pdfrw-0.4 pillow-5.2.0 pycparser-2.19 six-1.11.0 tinycss2-0.6.1 weasyprint-0.42.3 webencodings-0.5.1

And then of course running weasyprint produces:

Traceback (most recent call last):
  File "/usr/local/bin/weasyprint", line 7, in <module>
    from weasyprint.__main__ import main
  File "/usr/local/lib/python3.7/site-packages/weasyprint/__init__.py", line 375, in <module>
    from .css import preprocess_stylesheet  # noqa
  File "/usr/local/lib/python3.7/site-packages/weasyprint/css/__init__.py", line 29, in <module>
    from . import computed_values
  File "/usr/local/lib/python3.7/site-packages/weasyprint/css/computed_values.py", line 16, in <module>
    from .. import text
  File "/usr/local/lib/python3.7/site-packages/weasyprint/text.py", line 18, in <module>
    import cairocffi as cairo
  File "/usr/local/lib/python3.7/site-packages/cairocffi/__init__.py", line 41, in <module>
    cairo = dlopen(ffi, 'cairo', 'cairo-2', 'cairo-gobject-2')
  File "/usr/local/lib/python3.7/site-packages/cairocffi/__init__.py", line 38, in dlopen
    raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names))
OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2
```

@liZe
Copy link
Member

liZe commented Sep 26, 2018

OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2

@alecjacobson It means that Cairo is not in your library paths for some reason (it is on a fresh install on Travis). To add it, you can follow what's in #79, especially

$ export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib

@alecjacobson
Copy link

I'm using homebrew. If I do

DYLD_LIBRARY_PATH=/usr/local/lib weasyprint

Then I get a different error:

Traceback (most recent call last):
  File "/usr/local/bin/weasyprint", line 7, in <module>
    from weasyprint.__main__ import main
  File "/usr/local/lib/python3.7/site-packages/weasyprint/__init__.py", line 19, in <module>
    import html5lib
  File "/usr/local/lib/python3.7/site-packages/html5lib/__init__.py", line 28, in <module>
    from .serializer import serialize
  File "/usr/local/lib/python3.7/site-packages/html5lib/serializer.py", line 11, in <module>
    from xml.sax.saxutils import escape
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/xml/sax/saxutils.py", line 6, in <module>
    import os, urllib.parse, urllib.request
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 2583, in <module>
    from _scproxy import _get_proxy_settings, _get_proxies
ImportError: dlopen(/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_scproxy.cpython-37m-darwin.so, 2): Symbol not found: _inflateValidate
  Referenced from: /usr/local/lib/libPng.dylib
  Expected in: /usr/local/lib/libz.1.dylib
 in /usr/local/lib/libPng.dylib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Problems preventing documents from being rendered
Projects
None yet
Development

No branches or pull requests

10 participants