Python3-saml (Building wheel for xmlsec (pyproject.toml) ... error)

Hi,

I’m trying to install python3-saml and I get the error below.
All Debian system dependencies are covered.
Any light at the end of the tunnel?
Thkx

Building wheel for xmlsec (pyproject.toml) … error
error: subprocess-exited-with-error

× Building wheel for xmlsec (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [47 lines of output]
WARNING setuptools_scm.pyproject_reading toml section missing ‘pyproject.toml does not contain a tool.setuptools_scm section’
Traceback (most recent call last):
.
.
.
.
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for xmlsec
Failed to build xmlsec
ERROR: Failed to build installable wheels for some pyproject.toml based projects (xmlsec)

Can you please share the full command and output, not just the part with the error?

Oh, sorry, here is the complete error:

$ pip install python3-saml
Collecting python3-saml
  Using cached python3_saml-1.16.0-py3-none-any.whl.metadata (1.3 kB)
Requirement already satisfied: lxml!=4.7.0,>=4.6.5 in ./.venv/lib/python3.12/site-packages (from python3-saml) (5.3.0)
Collecting isodate>=0.6.1 (from python3-saml)
  Using cached isodate-0.7.2-py3-none-any.whl.metadata (11 kB)
Collecting xmlsec>=1.3.9 (from python3-saml)
  Using cached xmlsec-1.3.15.tar.gz (114 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Using cached python3_saml-1.16.0-py3-none-any.whl (76 kB)
Using cached isodate-0.7.2-py3-none-any.whl (22 kB)
Building wheels for collected packages: xmlsec
  Building wheel for xmlsec (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for xmlsec (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [47 lines of output]
      WARNING setuptools_scm.pyproject_reading toml section missing 'pyproject.toml does not contain a tool.setuptools_scm section'
      Traceback (most recent call last):
        File "/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/setuptools_scm/_integration/pyproject_reading.py", line 36, in read_pyproject
          section = defn.get("tool", {})[tool_name]
                    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
      KeyError: 'setuptools_scm'
      /tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!

              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:

              License :: OSI Approved :: MIT License

              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************

      !!
        self._finalize_license_expression()
      running bdist_wheel
      running build
      running build_py
      creating build/lib.linux-x86_64-cpython-312/xmlsec
      copying src/xmlsec/tree.pyi -> build/lib.linux-x86_64-cpython-312/xmlsec
      copying src/xmlsec/template.pyi -> build/lib.linux-x86_64-cpython-312/xmlsec
      copying src/xmlsec/__init__.pyi -> build/lib.linux-x86_64-cpython-312/xmlsec
      copying src/xmlsec/constants.pyi -> build/lib.linux-x86_64-cpython-312/xmlsec
      copying src/xmlsec/py.typed -> build/lib.linux-x86_64-cpython-312/xmlsec
      running build_ext
      building 'xmlsec' extension
      creating build/temp.linux-x86_64-cpython-312/tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src
      gcc -pthread -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -D__XMLSEC_FUNCTION__=__func__ -DXMLSEC_NO_SIZE_T -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_GOST2012=1 -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -DXMLSEC_CRYPTO_OPENSSL=1 -DMODULE_NAME=xmlsec -DMODULE_VERSION=1.3.15 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libxslt -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libexslt -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libxml -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/__pycache__ -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/extlibs -I/opt/indico/.venv/include -I/opt/indico/.pyenv/versions/3.12.9/include/python3.12 -c /tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/constants.c -o build/temp.linux-x86_64-cpython-312/tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/constants.o -g -std=c99 -fPIC -fno-strict-aliasing -Wno-error=declaration-after-statement -Werror=implicit-function-declaration -Os
      gcc -pthread -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -D__XMLSEC_FUNCTION__=__func__ -DXMLSEC_NO_SIZE_T -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_GOST2012=1 -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -DXMLSEC_CRYPTO_OPENSSL=1 -DMODULE_NAME=xmlsec -DMODULE_VERSION=1.3.15 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libxslt -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libexslt -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libxml -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/__pycache__ -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/extlibs -I/opt/indico/.venv/include -I/opt/indico/.pyenv/versions/3.12.9/include/python3.12 -c /tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/ds.c -o build/temp.linux-x86_64-cpython-312/tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/ds.o -g -std=c99 -fPIC -fno-strict-aliasing -Wno-error=declaration-after-statement -Werror=implicit-function-declaration -Os
      gcc -pthread -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -D__XMLSEC_FUNCTION__=__func__ -DXMLSEC_NO_SIZE_T -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_GOST2012=1 -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -DXMLSEC_CRYPTO_OPENSSL=1 -DMODULE_NAME=xmlsec -DMODULE_VERSION=1.3.15 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libxslt -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libexslt -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libxml -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/__pycache__ -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/extlibs -I/opt/indico/.venv/include -I/opt/indico/.pyenv/versions/3.12.9/include/python3.12 -c /tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/enc.c -o build/temp.linux-x86_64-cpython-312/tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/enc.o -g -std=c99 -fPIC -fno-strict-aliasing -Wno-error=declaration-after-statement -Werror=implicit-function-declaration -Os
      gcc -pthread -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -D__XMLSEC_FUNCTION__=__func__ -DXMLSEC_NO_SIZE_T -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_GOST2012=1 -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -DXMLSEC_CRYPTO_OPENSSL=1 -DMODULE_NAME=xmlsec -DMODULE_VERSION=1.3.15 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libxslt -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libexslt -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libxml -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/__pycache__ -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/extlibs -I/opt/indico/.venv/include -I/opt/indico/.pyenv/versions/3.12.9/include/python3.12 -c /tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/exception.c -o build/temp.linux-x86_64-cpython-312/tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/exception.o -g -std=c99 -fPIC -fno-strict-aliasing -Wno-error=declaration-after-statement -Werror=implicit-function-declaration -Os
      /tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/exception.c: In function ‘PyXmlSec_ExchangeLastError’:
      /tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/exception.c:76:9: warning: variable ‘r’ set but not used [-Wunused-but-set-variable]
         76 |     int r;
            |         ^
      gcc -pthread -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -D__XMLSEC_FUNCTION__=__func__ -DXMLSEC_NO_SIZE_T -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_GOST2012=1 -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -DXMLSEC_CRYPTO_OPENSSL=1 -DMODULE_NAME=xmlsec -DMODULE_VERSION=1.3.15 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libxslt -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libexslt -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/libxml -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/__pycache__ -I/tmp/pip-build-env-tomsjvet/overlay/lib/python3.12/site-packages/lxml/includes/extlibs -I/opt/indico/.venv/include -I/opt/indico/.pyenv/versions/3.12.9/include/python3.12 -c /tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/keys.c -o build/temp.linux-x86_64-cpython-312/tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/keys.o -g -std=c99 -fPIC -fno-strict-aliasing -Wno-error=declaration-after-statement -Werror=implicit-function-declaration -Os
      /tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/keys.c: In function ‘PyXmlSec_KeyFromEngine’:
      /tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/keys.c:218:65: error: ‘xmlSecKeyDataFormatEngine’ undeclared (first use in this function); did you mean ‘xmlSecKeyDataFormat’?
        218 |         key->handle = xmlSecCryptoAppKeyLoad(engine_and_key_id, xmlSecKeyDataFormatEngine, NULL, xmlSecCryptoAppGetDefaultPwdCallback(), (void*)engine_and_key_id);
            |                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
            |                                                                 xmlSecKeyDataFormat
      /tmp/pip-install-4dzhw0ac/xmlsec_747c302812a044dca4cda3dcbebb2e2b/src/keys.c:218:65: note: each undeclared identifier is reported only once for each function it appears in
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for xmlsec
Failed to build xmlsec
ERROR: Failed to build installable wheels for some pyproject.toml based projects (xmlsec)

It looks like you’re encountering this problem: Version 1.3.14 fails to compile · Issue #314 · xmlsec/python-xmlsec · GitHub

Hi,
I followed your suggestion and it worked out great.
apt install build-essential pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl libpython3.??-dev

Change libpython3.??-dev to whatever version of python you are using.
$ pip install xmlsec==1.3.13
$ pip install python3-saml
I thank you and everyone who answered my question.