WeasyPrint install instructions for Alpine Linux

See original GitHub issue

Just wanted to recommend adding to documentation instructions to install WeasyPrint in Alpine Linux 3.6. It took me a while but I made it work with this command: apk --update --upgrade add gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf

If someone else have a more efficient aproach (important when working with docker containers for small size images) can comment on this.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

15reactions
VDSharkcommented, Apr 15, 2019

Finally! With the latest versions of alpine & weasyprint we can keep build pretty small & clean.

Here my current approach:

FROM python:3.7-alpine
ENV PYTHONUNBUFFERED 1

RUN apk --update --upgrade --no-cache add \
    cairo-dev pango-dev gdk-pixbuf

...

ADD /etc/pip/requirements.txt /code/requirements.txt
RUN set -ex \
    && apk add --no-cache --virtual .build-deps \
        musl-dev gcc jpeg-dev zlib-dev libffi-dev \
    && pip install --no-cache-dir -r /code/requirements.txt \
    && apk del .build-deps

...

Packages cairo-dev pango-dev gdk-pixbuf need in runtime, so we kept them. Other ones need only on building stage - so we clean.

In requirements.txt just weasyprint and my specific dependencies, not related to this issue.

0reactions
dploegercommented, Jun 2, 2021

And this is also documented which I somehow overread 🙄

Read more comments on GitHub >

github_iconTop Results From Across the Web

First Steps — WeasyPrint 57.1 documentation - CourtBouillon
The easiest way to install WeasyPrint on Linux is to use the package manager of your distribution. WeasyPrint is packaged for recent versions...
Read more >
weasyprint - Alpine Linux packages
Package, weasyprint. Version, 57.1-r1. Description, A visual rendering engine for HTML and CSS that can export to PDF.
Read more >
James VL / weasyprint-docker-alpine - GitLab
Clone the repo, build the image, and run it, exposing port 5001. $ git clone https://gitlab.com/jamesvl/weasyprint-docker-alpine.git $ ...
Read more >
resolve pipenv install weasyprint error in Docker
I'm using Alpine linux for my Docker setup. Here is the Dockerfile. ... unable to execute 'gcc': No such file or directory. django...
Read more >
WeasyPrint Documentation - manpages.ubuntu!
Installation WeasyPrint 54.1 depends on: • Python ≥ 3.6.0 • Pango ... pip install weasyprint weasyprint --info Alpine ≥ 3.12 To install 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