Search code examples
pythondjangoweasyprint

Django weasyPrint fontconfig error


I have an application that I need to get pdf files from so I opted for weasyprint but after installing with PIP I imported import weasyprint I got an error in terminal OSError: ctype.util.find_library() did not manage to locate a library called fontconfig

Then I tried to use from weasyprint import HTML, CSS from weasyprint.fonts import FontConfiguration I still got the same error. Without writing any further codes the import statements is stuck on the error. I’m running the lates django and weasyprint as of October. Thanks in advance


Solution

  • reinstall weasyprint with python -m pip install weasyprint, but first run

    brew install python3 cairo pango gdk-pixbuf libffi 
    

    on mac osx