Weasyprint dependency 'gobject-2.0-0' installation error

osaheneFREE

10 months ago

I am using this dockerfile configuration for my django project

FROM python:3.12.2-slim-bullseye

# Install system dependencies

RUN apt-get update && apt-get install -y \

    python3-pip \

    python3-cffi \

    python3-brotli \

    libpango1.0-0 \

    libpangoft2-1.0-0 \

    libharfbuzz-subset0 \

    libffi-dev \

    libcairo2 \

    libcairo2-dev \

    libjpeg62-turbo-dev \

    libgdk-pixbuf2.0-0 \

    libgdk-pixbuf2.0-dev \

    libgobject-2.0-0 \

    libgobject2.0-dev \

    build-essential \

    && apt-get clean

# Set environment variables

ENV LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH

# Set the working directory

WORKDIR /PAQSBackend

# Copy the application code

COPY . /PAQSBackend/

# Install Python dependencies

RUN pip install -r requirements.txt

# Copy the WSGI entry point

COPY PAQSBackend.wsgi /PAQSBackend/PAQSBackend.wsgi

# Command to run the application

CMD ["gunicorn", "--bind", "0.0.0.0:8000", "PAQSBackend.wsgi"]

The build and deployment runs fine. However, when I run the project, I get this error message

File "/opt/venv/lib/python3.11/site-packages/cffi/api.py", line 827, in loadbackend_lib

raise OSError(msg)

OSError: cannot load library 'gobject-2.0-0': gobject-2.0-0: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called 'gobject-2.0-0'

I would want to know what is actually happening and also how to resolve this

1 Replies

shivamgarg001FREE

2 months ago

any answer?