[Python] ERROR: Could not build wheels for pyheif, which is required to install...

Discussão em 'Python' iniciado por Stack, Setembro 13, 2024.

  1. Stack

    Stack Membro Participativo

    Here's the post in English for Stack Overflow:

    **Error building pyheif package in Docker on Mac OS (works on Windows)

    I'm developing a Python application using Docker with Python 3.12. The application works fine on Windows, but when trying to build it on Mac OS, I encounter an error when installing the pyheif package. The error is related to a missing header file libheif/heif.h:

    error: command 'gcc' failed with exit status 1
    build/temp.linux-aarch64-3.7/_libheif_cffi.c:570:15: fatal error: libheif/heif.h: No such file or directory


    Here’s my Dockerfile:

    FROM python:3.12

    ENV MODE=testing

    EXPOSE 8000

    WORKDIR /app

    COPY requirements/ ./requirements/

    RUN apt-get update && \
    apt-get install -y gettext libheif-dev && \
    pip3 install --upgrade pip

    RUN pip3 install -r requirements/development.txt

    RUN mkdir media && mkdir basemod && mkdir main && mkdir templates && mkdir static && mkdir config && mkdir locale && mkdir logs

    COPY manage.py ./
    COPY secrets.json ./

    CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]


    I've already tried the following:

    1. Ensured the libheif-dev package is installed in the Docker image.
    2. Checked that libheif is available via Homebrew on Mac by running brew install libheif.
    3. Verified that I have the latest Xcode command-line tools with xcode-select --install.

    This works perfectly on Windows but fails on Mac OS. How can I resolve the issue with the missing libheif/heif.h on Mac in Docker? Any suggestions would be appreciated!

    Make sure to adapt this post to include any further specific details about your setup if needed!

    Continue reading...

Compartilhe esta Página