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

v53.0b2 Global Installation #1384

Closed
mikerockett opened this issue Jun 26, 2021 · 34 comments
Closed

v53.0b2 Global Installation #1384

mikerockett opened this issue Jun 26, 2021 · 34 comments
Labels
feature New feature that should be supported
Milestone

Comments

@mikerockett
Copy link

mikerockett commented Jun 26, 2021

How do I install this version globally (outside of a virtual environment)? I'm attempting to get this done in a GitLab CI script, and am battling with dependencies and errors.

My CI script is on a php:8 image as the package is for PHP and needs to be tested.

I've arrived at a point where the dependencies seem correct, but am now getting this error:

AttributeError: function/symbol 'pango_context_set_round_glyph_positions' not found in library 'libpango-1.0.so.0': /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: pango_context_set_round_glyph_positions

These are the dependencies (some for PHP):

apt install -yqq build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget git libmcrypt-dev python3-dev python3-pip python3-setuptools python3-wheel python3-cffi python3-venv libpango1.0-dev libzip-dev libharfbuzz-dev libpangoft2-1.0-0 libjpeg-dev libpng-dev

Many thanks!

@liZe
Copy link
Member

liZe commented Jun 26, 2021

Hello!

WeasyPrint 53 requires at least Pango 1.44. You probably have an older version, that’s why you get this error.

@liZe liZe closed this as completed Jun 26, 2021
@mikerockett
Copy link
Author

mikerockett commented Jun 26, 2021

Thanks, but if I use libpango-1.0-0 (or -dev), am I not getting 1.44?

@liZe
Copy link
Member

liZe commented Jun 26, 2021

You can get your version of Pango with pango-view --version.

@mikerockett
Copy link
Author

I see, it's giving me Pango version 14203 for some reason. Will figure out why and get it to upgrade. Thanks for the help.

@mikerockett
Copy link
Author

After some digging, turns out it's that Debian’s repo does not include 1.44. Unable to get around this in a CI environment, sans waiting for the next Debian to be released.

That having been said, I think it would be great if the new docs could show the steps required to get WeasyPrint up and running globally, outside of a virtual environment. Whilst virtual environments seem cool (note: this coming from a developer who does not develop in Python), it does mean that the binary path varies from environment to environment, and sometimes a constant global path might be required.

Do you think this is something that could be added to the docs?

@mpth
Copy link

mpth commented Jul 17, 2021

Running into the same issue trying to get v53.0b2 to run in my Debian buster docker image

@liZe
Copy link
Member

liZe commented Jul 17, 2021

After some digging, turns out it's that Debian’s repo does not include 1.44. Unable to get around this in a CI environment, sans waiting for the next Debian to be released.

Running into the same issue trying to get v53.0b2 to run in my Debian buster docker image

Then it’s probably time to find a workaround for Pango < 1.44.

@liZe liZe reopened this Jul 17, 2021
@liZe liZe added the feature New feature that should be supported label Jul 17, 2021
@liZe liZe added this to the 53.0 milestone Jul 17, 2021
@liZe liZe closed this as completed in 51b90ec Jul 18, 2021
@liZe
Copy link
Member

liZe commented Jul 18, 2021

The workaround has been added, and will be removed when the next Debian stable version is released. Tests are welcome!

Note that using Pango < 1.44 brings #1199 back.

@liZe
Copy link
Member

liZe commented Jul 18, 2021

That’s broken, because we miss pango_font_get_hb_font too.

@liZe liZe reopened this Jul 18, 2021
@liZe
Copy link
Member

liZe commented Jul 18, 2021

Hmmmm… I’m really sorry, but in my opinion there’s no way to replace pango_font_get_hb_font :/. We now deeply rely on Harfbuzz to display text, and there’s no public API to get the Harfbuzz font out of the FontConfig objects provided by Pango 1.42. That’s exactly why it’s been added in 1.44.

Yes, that’s really annoying. We have Pango 1.44+ in the latest version of many distributions, and even in the latest Ubuntu LTS, but not in Debian stable or in CentOS.

If someone is really motivated and knows Pango 1.42 very well, I would be interested in a dirty workaround, but unfortunately I’m not able to write this one myself. Otherwise, I’m afraid that distributions with Pango 1.42 will have to keep WeasyPrint 52.x :/.

"Good" news is that Bullseye hit "full freeze" status yesterday. It’s the last step before the release, it took about 3.5 months for Buster and Stretch.

I’m really open to discussion about this topic.

@liZe
Copy link
Member

liZe commented Jul 28, 2021

"Good" news is that Bullseye hit "full freeze" status yesterday. It’s the last step before the release, it took about 3.5 months for Buster and Stretch.

Release date is 14 August, Debian users won’t have to wait for too long.

CentOS / RHEL / AWS is another problem. The next dev version was announced for Q2 2021, but I didn’t find anything more than that.

If anyone is interested in discussing this topic, it’s the last call. We’ve already updated the documentation to warn users about this problem.

@mikerockett
Copy link
Author

From my side, CI is using Debian, so I'm happy to wait it out. Thanks! :)

@liZe
Copy link
Member

liZe commented Jul 31, 2021

Feel free to reopen if anyone thinks that this topic requires more discussion.

@liZe liZe closed this as completed Jul 31, 2021
fdemmer added a commit to fdemmer/django-weasyprint that referenced this issue Aug 11, 2021
WeasyPrint >= 53 requires pango 1.44
Kozea/WeasyPrint#1384
fdemmer added a commit to fdemmer/django-weasyprint that referenced this issue Aug 11, 2021
WeasyPrint >= 53 requires pango 1.44
Kozea/WeasyPrint#1384
@danfoster
Copy link

I was using the official python docker images, which is based on buster, and hit this issue.
To work around it, I've created a python image based on Ubuntu focal. I'm sharing it in case it's useful to anyone else: https://hub.docker.com/repository/docker/danfoster/python

@bauti-defi
Copy link

bauti-defi commented Aug 13, 2021

Hello, we have recently ran into breaking changes with v53. We are running the application in a docker FROM PYTHON-3.8.

The stacktrace is the following:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 369, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 59, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 580, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 241, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 52, in app
    response = await func(request)
  File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 219, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 152, in run_endpoint_function
    return await dependant.call(**values)
  File "/usr/app/financeServer/service/./main.py", line 60, in image
    await getPDF()
  File "/usr/app/financeServer/core/cache/liniersHandler.py", line 14, in getPDF
    response= await fetchAndCachePDF(start_date, end_date)
  File "/usr/app/financeServer/core/data/prices/liniers.py", line 31, in fetchAndCachePDF
    HTML(string=html_doc).write_pdf(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/__init__.py", line 180, in write_pdf
    self.render(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/__init__.py", line 134, in render
    return Document._render(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/document.py", line 885, in _render
    [Page(page_box) for page_box in page_boxes],
  File "/usr/local/lib/python3.8/site-packages/weasyprint/document.py", line 885, in <listcomp>
    [Page(page_box) for page_box in page_boxes],
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/__init__.py", line 124, in layout_document
    pages = list(make_all_pages(context, root_box, html, pages))
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/pages.py", line 802, in make_all_pages
    page, resume_at = remake_page(i, context, root_box, html)
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/pages.py", line 739, in remake_page
    page, resume_at, next_page = make_page(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/pages.py", line 549, in make_page
    root_box, resume_at, next_page, _, _ = block_level_layout(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/blocks.py", line 58, in block_level_layout
    return block_level_layout_switch(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/blocks.py", line 72, in block_level_layout_switch
    return block_box_layout(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/blocks.py", line 126, in block_box_layout
    block_container_layout(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/blocks.py", line 517, in block_container_layout
    collapsing_through) = block_level_layout(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/blocks.py", line 58, in block_level_layout
    return block_level_layout_switch(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/blocks.py", line 72, in block_level_layout_switch
    return block_box_layout(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/blocks.py", line 126, in block_box_layout
    block_container_layout(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/blocks.py", line 517, in block_container_layout
    collapsing_through) = block_level_layout(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/blocks.py", line 58, in block_level_layout
    return block_level_layout_switch(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/blocks.py", line 72, in block_level_layout_switch
    return block_box_layout(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/blocks.py", line 126, in block_box_layout
    block_container_layout(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/blocks.py", line 379, in block_container_layout
    for i, (line, resume_at) in enumerate(lines_iterator):
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/inlines.py", line 48, in iter_line_boxes
    line, resume_at = get_next_linebox(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/inlines.py", line 175, in get_next_linebox
    last_letter, float_width) = split_inline_box(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/inlines.py", line 845, in split_inline_box
    split_inline_level(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/inlines.py", line 682, in split_inline_level
    new_box, skip, preserved_line_break = split_text_box(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/layout/inlines.py", line 1103, in split_text_box
    layout, length, resume_at, width, height, baseline = split_first_line(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/text/line_break.py", line 341, in split_first_line
    layout = create_layout(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/text/line_break.py", line 277, in create_layout
    layout = Layout(
  File "/usr/local/lib/python3.8/site-packages/weasyprint/text/line_break.py", line 84, in __init__
    self.setup(context, font_size, style)
  File "/usr/local/lib/python3.8/site-packages/weasyprint/text/line_break.py", line 100, in setup
    pango.pango_context_set_round_glyph_positions(pango_context, False)
  File "/usr/local/lib/python3.8/site-packages/cffi/api.py", line 912, in __getattr__
    make_accessor(name)
  File "/usr/local/lib/python3.8/site-packages/cffi/api.py", line 908, in make_accessor
    accessors[name](name)
  File "/usr/local/lib/python3.8/site-packages/cffi/api.py", line 838, in accessor_function
    value = backendlib.load_function(BType, name)
AttributeError: function/symbol 'pango_context_set_round_glyph_positions' not found in library 'libpango-1.0.so.0': /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: pango_context_set_round_glyph_positions

We believe the error is caused by v53 requiring pango >= 1.44.0

Our Dockerfile, which used to work with previous weasyprint versions, contains the following line:
RUN apt-get install libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info

We are considering either downgrading back to weasyprint v52 or attempting to upgrade the pango version... What do you all recommend?

@liZe
Copy link
Member

liZe commented Aug 13, 2021

We believe the error is caused by v53 requiring pango >= 1.44.0

That’s the cause of this problem.

We are considering either downgrading back to weasyprint v52 or attempting to upgrade the pango version... What do you all recommend?

You can wait for the next version of Debian stable (11, Bullseye), it’s expected to be released tomorrow and it includes a recent version of Pango.

@bauti-defi
Copy link

bauti-defi commented Aug 13, 2021

We believe the error is caused by v53 requiring pango >= 1.44.0

That’s the cause of this problem.

We are considering either downgrading back to weasyprint v52 or attempting to upgrade the pango version... What do you all recommend?

You can wait for the next version of Debian stable (11, Bullseye), it’s expected to be released tomorrow and it includes a recent version of Pango.

Thank you for such a quick response. We have gone ahead and downgraded weasyprint to v52. Everything is back to normal. On a side note, if we wait for Bullseye, will we have to change anything in the Dockerfile? Maybe remove this line completely?: RUN apt-get install libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info

@liZe
Copy link
Member

liZe commented Aug 13, 2021

You can find an updated list of required packages in the documentation.

@sakshamre
Copy link

sakshamre commented Aug 20, 2021

  Traceback (most recent call last):
  File "weekly_report.py", line 227, in <module>
    HTML(string=html_out).write_pdf(filename)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/__init__.py", line 183, in write_pdf
    counter_style=counter_style, image_cache=image_cache)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/__init__.py", line 136, in render
    optimize_size, font_config, counter_style, image_cache)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/document.py", line 885, in _render
    [Page(page_box) for page_box in page_boxes],
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/document.py", line 885, in <listcomp>
    [Page(page_box) for page_box in page_boxes],
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/__init__.py", line 124, in layout_document
    pages = list(make_all_pages(context, root_box, html, pages))
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/pages.py", line 802, in make_all_pages
    page, resume_at = remake_page(i, context, root_box, html)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/pages.py", line 741, in remake_page
    page_number, page_state)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/pages.py", line 552, in make_page
    positioned_boxes, adjoining_margins, discard=False)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 60, in block_level_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins, discard)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 75, in block_level_layout_switch
    discard)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 128, in block_box_layout
    absolute_boxes, fixed_boxes, adjoining_margins, discard)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 520, in block_container_layout
    absolute_boxes, fixed_boxes, adjoining_margins, discard)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 60, in block_level_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins, discard)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 75, in block_level_layout_switch
    discard)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 128, in block_box_layout
    absolute_boxes, fixed_boxes, adjoining_margins, discard)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 520, in block_container_layout
    absolute_boxes, fixed_boxes, adjoining_margins, discard)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 60, in block_level_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins, discard)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 75, in block_level_layout_switch
    discard)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 128, in block_box_layout
    absolute_boxes, fixed_boxes, adjoining_margins, discard)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 379, in block_container_layout
    for i, (line, resume_at) in enumerate(lines_iterator):
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/inlines.py", line 50, in iter_line_boxes
    absolute_boxes, fixed_boxes, first_letter_style)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/inlines.py", line 178, in get_next_linebox
    line_children=[])
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/layout/inlines.py", line 1059, in split_inline_box
    line_height, new_box.baseline = strut_layout(box.style, context)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/css/computed_values.py", line 730, in strut_layout
    layout = Layout(context, style['font_size'], style)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/text/line_break.py", line 84, in __init__
    self.setup(context, font_size, style)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/weasyprint/text/line_break.py", line 100, in setup
    pango.pango_context_set_round_glyph_positions(pango_context, False)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/cffi/api.py", line 912, in __getattr__
    make_accessor(name)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/cffi/api.py", line 908, in make_accessor
    accessors[name](name)
  File "/var/lib/jenkins/.local/lib/python3.6/site-packages/cffi/api.py", line 838, in accessor_function
    value = backendlib.load_function(BType, name)
AttributeError: function/symbol 'pango_context_set_round_glyph_positions' not found in library 'libpango-1.0.so.0': /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: pango_context_set_round_glyph_positions
Build step 'Execute shell' marked build as failure

Currently facing the same issue while building python script on Jenkins. How can I mitigate the error? I've tried upgrading almost every library.

@grewn0uille
Copy link
Member

Version 53 of WeasyPrint requires pango >= 1.44.0.
If your distribution doesn’t provide a recent version of pango, you can downgrade WeasyPrint to v52.5.

@sakshamre
Copy link

weasyprint --info
System: Linux
Machine: x86_64
Version: #48~18.04.1-Ubuntu SMP Tue Apr 13 19:41:38 UTC 2021
Release: 5.4.0-1046-azure

WeasyPrint version: 52.5
Python version: 3.6.9
Cairo version: 11510
Pango version: 14014
CairoSVG version: 2.5.2

Already done, yet I receive the same error.

@liZe
Copy link
Member

liZe commented Aug 20, 2021

Already done, yet I receive the same error.

That’s strange, because pango_context_set_round_glyph_positions is not used at all in version 52.5. Could you please give the backtrace you get with version 52.5?

@sakshamre
Copy link

My apologies, I had both weasyprint 53 and 52.5 installed. Removed the version 53, and it worked well.

Already done, yet I receive the same error.

That’s strange, because pango_context_set_round_glyph_positions is not used at all in version 52.5. Could you please give the backtrace you get with version 52.5?

@kamaleshtangudu
Copy link

@liZe Is there any work around found for AWS Lambda. I am trying to use weasyprint v53.1 with pango 1.48+ and I get the same error.

    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/__init__.py\", line 134, in render\n    return Document._render(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/document.py\", line 887, in _render\n    [Page(page_box) for page_box in page_boxes],\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/document.py\", line 887, in <listcomp>\n    [Page(page_box) for page_box in page_boxes],\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/__init__.py\", line 124, in layout_document\n    pages = list(make_all_pages(context, root_box, html, pages))\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/pages.py\", line 802, in make_all_pages\n    page, resume_at = remake_page(i, context, root_box, html)\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/pages.py\", line 739, in remake_page\n    page, resume_at, next_page = make_page(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/pages.py\", line 549, in make_page\n    root_box, resume_at, next_page, _, _ = block_level_layout(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/blocks.py\", line 58, in block_level_layout\n    return block_level_layout_switch(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/blocks.py\", line 72, in block_level_layout_switch\n    return block_box_layout(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/blocks.py\", line 123, in block_box_layout\n    result = block_container_layout(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/blocks.py\", line 514, in block_container_layout\n    collapsing_through) = block_level_layout(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/blocks.py\", line 58, in block_level_layout\n    return block_level_layout_switch(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/blocks.py\", line 72, in block_level_layout_switch\n    return block_box_layout(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/blocks.py\", line 123, in block_box_layout\n    result = block_container_layout(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/blocks.py\", line 376, in block_container_layout\n    for i, (line, resume_at) in enumerate(lines_iterator):\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/inlines.py\", line 48, in iter_line_boxes\n    line, resume_at = get_next_linebox(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/inlines.py\", line 176, in get_next_linebox\n    last_letter, float_width) = split_inline_box(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/inlines.py\", line 846, in split_inline_box\n    split_inline_level(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/inlines.py\", line 683, in split_inline_level\n    new_box, skip, preserved_line_break = split_text_box(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/layout/inlines.py\", line 1105, in split_text_box\n    layout, length, resume_index, width, height, baseline = split_first_line(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/text/line_break.py\", line 341, in split_first_line\n    layout = create_layout(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/text/line_break.py\", line 277, in create_layout\n    layout = Layout(\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/text/line_break.py\", line 84, in __init__\n    self.setup(context, font_size, style)\n",
    "  File \"/opt/python/lib/python3.8/site-packages/weasyprint/text/line_break.py\", line 100, in setup\n    pango.pango_context_set_round_glyph_positions(pango_context, False)\n",
    "  File \"/opt/python/lib/python3.8/site-packages/cffi/api.py\", line 912, in __getattr__\n    make_accessor(name)\n",
    "  File \"/opt/python/lib/python3.8/site-packages/cffi/api.py\", line 908, in make_accessor\n    accessors[name](name)\n",
    "  File \"/opt/python/lib/python3.8/site-packages/cffi/api.py\", line 838, in accessor_function\n    value = backendlib.load_function(BType, name)\n"

@grewn0uille
Copy link
Member

Hello!

WeasyPrint 53 needs pango >= 1.44. As far as I know, the version of pango available on Amazon Linux 2 is 1.42.
So you can downgrade the version of WeasyPrint to 52.5, or try to compile pango by yourself (but I don’t really believe in that).

Maybe @kalekseev knows more about that? :)

And I think it would be best to open a new issue about that, as this one is closed and is about the beta.

@kalekseev
Copy link
Contributor

Maybe @kalekseev knows more about that? :)

Pinned layer to v52 for now https://github.com/kotify/cloud-print-utils/pull/7/files
Workaround is to run lambda inside docker https://aws.amazon.com/ru/blogs/aws/new-for-aws-lambda-container-image-support/

@kamaleshtangudu
Copy link

@kalekseev thanks for the help. Did the same as your pull suggests within my clone with added personal dependencies. Thanks again @kalekseev @grewn0uille .

@mpth
Copy link

mpth commented Oct 14, 2021

Just for the record. WeasyPrint 53.3 now working fine for me after using a Debian Bullseye based docker image.

richmahn added a commit to unfoldingWord/tx-job-handler that referenced this issue Oct 29, 2021
fdemmer added a commit to fdemmer/django-weasyprint that referenced this issue Feb 24, 2022
WeasyPrint >= 53 requires pango 1.44
Kozea/WeasyPrint#1384
@rrr3try
Copy link

rrr3try commented May 20, 2022

Same issue on Mac with arm M1

WeasyPrint==55.0
docker image python:3.10.3-slim-buster
libpango-1.0-0 installed

E AttributeError: function/symbol 'pango_context_set_round_glyph_positions' not found in library 'libpango-1.0.so.0': /usr/lib/aarch64-linux-gnu/libpango-1.0.so.0: undefined symbol: pango_context_set_round_glyph_positions

@liZe
Copy link
Member

liZe commented May 20, 2022

@rrr3try As explained in the documentation, recent versions of WeasyPrint require Pango ≥ 1.44.0. Upgrade Pango or use an older version of WeasyPrint.

@hamzashabbir11
Copy link

hamzashabbir11 commented Apr 23, 2023

Finally Got Weasyprint to work in AWS Lambda. ✅
Thanks Everyone for the support. I have created a .zip file for weasyprint dependencies ready to use 🚀
https://github.com/hamzashabbir11/weasyprint-aws-lambda

@lyf2000
Copy link

lyf2000 commented Aug 10, 2023

Can you please help me with same issue?
I have Docker python:3.11-slim-buster (Ubuntu 22.04) and weasyprint==59.0
Also apt-get install -y libpango1.0-dev libharfbuzz0b libpangoft2-1.0-0

And pango-view --version gives me:
pango-view (pango) 1.42.3

I tried to update pango to >= 1.44 but failed to do it, can you please help me how to install higher version of pango?

@liZe
Copy link
Member

liZe commented Aug 11, 2023

I tried to update pango to >= 1.44 but failed to do it, can you please help me how to install higher version of pango?

python:3.11-slim-buster is not Ubuntu 22.04, it’s 4-year-old Debian Buster.

Debian Buster provides Pango 1.42.3. If you want a more recent version of Pango, you’ll need a more recent of Debian: use the python:3.11-slim-bullseye or more recent.

@lyf2000
Copy link

lyf2000 commented Aug 13, 2023

I tried to update pango to >= 1.44 but failed to do it, can you please help me how to install higher version of pango?

python:3.11-slim-buster is not Ubuntu 22.04, it’s 4-year-old Debian Buster.

Debian Buster provides Pango 1.42.3. If you want a more recent version of Pango, you’ll need a more recent of Debian: use the python:3.11-slim-bullseye or more recent.

wow, thank you, now I fixed it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature that should be supported
Projects
None yet
Development

No branches or pull requests