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.

WeasyPrint 53.0 doesn't work with Pandoc for me

See original GitHub issue

I recently upgraded to version 53.0 from 52.5 and this is now what happens when I try to use Pandoc with WeasyPrint:

$ pandoc --pdf-engine weasyprint -c ../style.css input.md -s -o output.pdf
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.9/weasyprint", line 33, in <module>
    sys.exit(load_entry_point('weasyprint==53.0', 'console_scripts', 'weasyprint')())
  File "/usr/lib/python-exec/python3.9/weasyprint", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/lib/python3.9/site-packages/weasyprint/__init__.py", line 322, in <module>
    from .css import preprocess_stylesheet  # noqa isort:skip
  File "/usr/lib/python3.9/site-packages/weasyprint/css/__init__.py", line 27, in <module>
    from . import computed_values, counters, media_queries
  File "/usr/lib/python3.9/site-packages/weasyprint/css/computed_values.py", line 16, in <module>
    from ..text.ffi import ffi, pango, units_to_double
ModuleNotFoundError: No module named 'weasyprint.text'
Error producing PDF.

Downgrading to version 52.5 solves the issue.

I’m using Gentoo Linux with Pandoc 2.14.1 and Python 3.9.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Hundcommented, Aug 8, 2021

This bug was caused by pyproject2setuppy, a custom tool used by Gentoo to install Python packages (hello #1410!). It’s now fixed, the right dependency should be added to the ebuild soon.

That’s good news. 😃

1reaction
liZecommented, Aug 5, 2021

WeasyPrint 53.0 is not packaged for Gentoo (yet), is it? By the way, the bug is probably in the ebuild, not in WeasyPrint, so you should definitely create a ticket for the ebuild maintainer.

Let us know if there’s anything we can do to help with the ebuild (I’m a Gentoo user too 😉).

Read more comments on GitHub >

github_iconTop Results From Across the Web

dev-python/weasyprint-53.0 doesn't work with app-text/pandoc
css input.md -s -o output.pdf Traceback (most recent call last): File "/usr/lib/python-exec/python3.9/weasyprint", line 33, in <module> sys.exit ...
Read more >
Setuptools build shim doesn't actually install script · Issue #1410
I'm trying to upgrade the Arch Linux AUR package to 53.0 and something isn't right ... WeasyPrint 53.0 doesn't work with Pandoc for...
Read more >
Pandoc, Weasyprint, and PDF generation - Dave Zvenyach
I love writing in plain text. Given the choice between writing a document in Word, Google Docs, or my text editor (I primarily...
Read more >
Creating a Nice-Looking PDF with pandoc
What you get looks pretty much the same when you use WeasyPrint to do the conversion. The result is functional, but it's not...
Read more >
Creating a PDF with css and html with pandoc - Stack Overflow
I'm using the arguments below but most of the css doesn't get applied. pandoc example.html -t html5 -o example.pdf --pdf-engine weasyprint ...
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