0

I can't get the Python:Alpine Docker image to install all my required PIP libraries.

Unfortunately installing PyGObject is failing all the time and I can't get it running.

  Building wheel for PyGObject (pyproject.toml): started
  Building wheel for PyGObject (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error
  
  × Building wheel for PyGObject (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [44 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-39
      creating build/lib.linux-x86_64-cpython-39/pygtkcompat
      copying pygtkcompat/generictreemodel.py -> build/lib.linux-x86_64-cpython-39/pygtkcompat
      copying pygtkcompat/__init__.py -> build/lib.linux-x86_64-cpython-39/pygtkcompat
      copying pygtkcompat/pygtkcompat.py -> build/lib.linux-x86_64-cpython-39/pygtkcompat
      creating build/lib.linux-x86_64-cpython-39/gi
      copying gi/importer.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/module.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/_gtktemplate.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/_signalhelper.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/_constants.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/_ossighelper.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/_error.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/types.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/__init__.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/docstring.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/pygtkcompat.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/_option.py -> build/lib.linux-x86_64-cpython-39/gi
      copying gi/_propertyhelper.py -> build/lib.linux-x86_64-cpython-39/gi
      creating build/lib.linux-x86_64-cpython-39/gi/repository
      copying gi/repository/__init__.py -> build/lib.linux-x86_64-cpython-39/gi/repository
      creating build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/GdkPixbuf.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/Gtk.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/keysyms.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/GIMarshallingTests.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/Pango.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/Gio.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/__init__.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/Gdk.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/GObject.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      copying gi/overrides/GLib.py -> build/lib.linux-x86_64-cpython-39/gi/overrides
      running build_ext
      Package gobject-introspection-1.0 was not found in the pkg-config search path.
      Perhaps you should add the directory containing `gobject-introspection-1.0.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'gobject-introspection-1.0' found
      Command '('pkg-config', '--print-errors', '--exists', 'gobject-introspection-1.0 >= 1.56.0')' returned non-zero exit status 1.
      
      Try installing it with: 'sudo apt install libgirepository1.0-dev'
      [end of output]

Here is my Docker file

FROM python:alpine
EXPOSE 8000

RUN apk update
RUN apk add --no-cache git gcc musl-dev libffi-dev libxml2-dev libxslt-dev gcc swig g++
RUN apk add --no-cache apk-gtk3 cairo-dev cairo-gobject py3-gobject3 py3-gobject3-dev 
RUN apk add --no-cache jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev
RUN apk add --no-cache postgresql postgresql-dev clamav-daemon
RUN apk add --no-cache bash ffmpeg libmagic
RUN apk add --no-cache gobject-introspection-dev gobject-introspection 
RUN python3 -m pip install --upgrade pip setuptools wheel

RUN mkdir /opt/app
WORKDIR /opt/app
RUN pip3 install gunicorn
RUN pip3 install wheel

COPY requirements.txt .
RUN pip3 install -r requirements.txt

Any hint is welcome.

David
  • 159
  • 8

0 Answers0