Skip to content

xmlsec.InternalError: (-1, 'lxml & xmlsec libxml2 library version mismatch') #440

@vaibhavmano

Description

@vaibhavmano

Issues with xmlsec.InternalError: (-1, 'lxml & xmlsec libxml2 library version mismatch')

We're currently using python3-saml and we're running into issues during development and production. We have a variety of devices that we use for development including Intel Mac, M-Series Mac and our production deployment is a docker container running on Ubuntu 24.04.

I've tried various fixed including pinning the version of the both xmlsec and lxml. Below are the versions that is currently being used.
"python3-saml==1.16.0"
"lxml>=4.6.5,!=4.7.0,<=5.2.1"

Below is my docker file and

RUN <<EOF
set -e
apt-get update -y
apt-get install -y libxml2-dev libxmlsec1-dev libxmlsec1-openssl pkg-config
rm -rf /var/lib/apt/lists/
EOF


COPY /pyproject.toml /build/
COPY /uv.lock /build/
COPY /baselib /build/baselib
COPY /bo /build/bo
COPY /user /build/user

WORKDIR /build
RUN --mount=type=cache,target=${UV_CACHE_DIR} \
    uv sync --active --frozen --no-group dev --package user --no-binary-package lxml

This seems to fix the issue when I build and run the image locally (Intel Mac) but fails when deploying to production. Is there a proper way to resolve this issue because this seems like it has been going on forever with no real fix other than to build the packages directly from source?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions