Skip to content

Building docker generates error related to cairo.h #1

@aishniparab

Description

@aishniparab

Running docker build . generated the folllwing error:

20.72   creating build/temp.linux-x86_64-cpython-310/tmp/tmpojsveprv/ManimPango-0.5.0/manimpango
20.72   x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/tmp/tmpcdy30dsc/.venv/include -I/usr/include/python3.10 -c /tmp/tmpojsveprv/ManimPango-0.5.0/manimpango/cmanimpango.c -o build/temp.linux-x86_64-cpython-310/tmp/tmpojsveprv/ManimPango-0.5.0/manimpango/cmanimpango.o
20.72   /tmp/tmpojsveprv/ManimPango-0.5.0/manimpango/cmanimpango.c:1245:10: fatal error: cairo.h: No such file or directory
20.72    1245 | #include "cairo.h"
20.72         |          ^~~~~~~~~
20.72   compilation terminated.
20.72   error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
20.72   
20.72 
20.72   at .local/pipx/venvs/poetry/lib/python3.10/site-packages/poetry/installation/chef.py:164 in _prepare
20.73       160│ 
20.73       161│                 error = ChefBuildError("\n\n".join(message_parts))
20.73       162│ 
20.73       163│             if error is not None:
20.73     → 164│                 raise error from None
20.73       165│ 
20.73       166│             return path
20.73       167│ 
20.73       168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:
20.73 
20.73 Note: This error originates from the build backend, and is likely not a problem with poetry but with manimpango (0.5.0) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "manimpango (==0.5.0)"'.
20.73 
------
Dockerfile:22

I fixed this by changing the Dockerfile:


MAINTAINER McCoy "Hoss" Becker <mccoyb@mit.edu>

RUN apt-get update && apt-get install -y --no-install-recommends \
    virtualenv \
    curl \
    pipx \
    pkg-config \
    libcairo2-dev \
    libpango1.0-dev \
    libpangocairo-1.0-0 \
    libgirepository1.0-dev \
    gir1.2-pango-1.0 \
    python3-dev \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin

RUN groupadd -g 1001 wizard
RUN useradd -rm -d /home/wizard -s /bin/bash -g wizard -G sudo -u 1001 wizard
USER wizard
WORKDIR /home/wizard
RUN pipx ensurepath
RUN pipx install poetry
SHELL ["/bin/bash", "-l", "-c"]
ADD . /home/wizard
RUN poetry install

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions