how to debug weasyprint error - failed to load a library: cairo / cairo-2

1,809 views
Skip to first unread message

Michael Beller

unread,
Jun 14, 2016, 6:57:34 PM6/14/16
to web2py-users
I posted this on the pythonanywhere (PAW) forums also but I think it may be web2py specific (or at least specific to the PAW/web2py combination) ...

I'm using weasyprint to generate a PDF.  It's working on my local dev environment and my PAW personal account.

On a new PAW account it fails on:
from weasyprint import HTML, CSS

with the error:
OSError: dlopen() failed to load a library: cairo / cairo-2

On the new PAW account, the import works in a python console (just not from within the web2py app).

As far as I can tell, the original and new PAW accounts are identical.  I also recently create a new virtualenv on the new account to try and isolate the library/package that may be out of sync but I'm getting the same error.

Any ideas how to debug?

Michael Beller

unread,
Jun 15, 2016, 5:30:49 PM6/15/16
to web2py-users
Just for the record ... I solved this by deleting the virtualenv and all user installed libraries (using 'pip uninstall ...').  Then simply reinstalling 'pip install --user weasyprint==0.27'

I never found the root cause of the problem.  Here is the conversation on PAW with some more info if anybody in the future needs it ...
Reply all
Reply to author
Forward
0 new messages