SAML-Toolkits / python3-saml

MIT License
670 stars 302 forks source link

Cannot install python3-saml due to xmlsec in Docker #382

Closed TheDataDexter closed 5 months ago

TheDataDexter commented 9 months ago

Hi there,

Running into a problem when building a Dockerfile. It seems to have to do with the underlying package xmlsec. I've tried several versions and still running into the problem

Similar issue to: https://github.com/SAML-Toolkits/python3-saml/issues/318

Build command:

ARG PYTHON_VERSION=3.10-slim-bullseye

# define an alias for the specfic python version used in this file.
FROM --platform=linux/amd64 python:${PYTHON_VERSION} as python
RUN apt-get update && apt-get install --no-install-recommends -y \
  libxmlsec1 libxmlsec1-dev libxml2 pkg-config

# Install pipenv
RUN pip install -U pip
RUN pip install xmlsec==1.3.13
# Python build stage
FROM python as python-build-stage

# Install apt packages
RUN apt-get update && apt-get install --no-install-recommends -y \
  # dependencies for building Python packages
  build-essential \
  # psycopg2 dependencies
  libpq-dev \
  # Translations dependencies
  gettext

# Requirements are installed here to ensure they will be cached.
COPY ./requirements .

# Create Python Dependency and Sub-Dependency Wheels.
RUN pip wheel --wheel-dir /usr/src/app/wheels --verbose \
  -r dev.txt

Error trace:

Building wheel for xmlsec (pyproject.toml): started
   Building wheel for xmlsec (pyproject.toml): finished with status 'error'
   error: subprocess-exited-with-error

   × Building wheel for xmlsec (pyproject.toml) did not run successfully.
   │ exit code: 1
   ╰─> [21 lines of output]
       WARNING setuptools_scm.pyproject_reading toml section missing 'pyproject.toml does not contain a tool.setuptools_scm section'
       running bdist_wheel
       running build
       running build_py
       creating build
       creating build/lib.linux-x86_64-cpython-310
       creating build/lib.linux-x86_64-cpython-310/xmlsec
       copying src/xmlsec/py.typed -> build/lib.linux-x86_64-cpython-310/xmlsec
       copying src/xmlsec/constants.pyi -> build/lib.linux-x86_64-cpython-310/xmlsec
       copying src/xmlsec/template.pyi -> build/lib.linux-x86_64-cpython-310/xmlsec
       copying src/xmlsec/__init__.pyi -> build/lib.linux-x86_64-cpython-310/xmlsec
       copying src/xmlsec/tree.pyi -> build/lib.linux-x86_64-cpython-310/xmlsec
       running build_ext
       building 'xmlsec' extension
       creating build/temp.linux-x86_64-cpython-310
       creating build/temp.linux-x86_64-cpython-310/tmp
       creating build/temp.linux-x86_64-cpython-310/tmp/pip-install-173l7zot
developer992 commented 7 months ago

try this:

apt install build-essential pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl libpython3.11-dev

Change libpython3.11-dev to whatever version of python you are using.

also, you need to install it, before installing xmlsec ... move it above this line RUN pip install xmlsec==1.3.13 first install apt packages, then pip