Skip to content

Error installing xmlsec==1.3.13 on poetry #337

Open

Description

@GbAraujoSouza

I'm running a project using poetry to isolate and manage dependencies.
The python version that I'm using on poetry is 3.9.20, as projet subdependencies require that version of python

When running poetry install, I'm receiving an error while installing xmlsec on version 1.3.13:

- Installing xmlsec (1.3.13): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel

  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/tmp3rr37sfq/.venv/lib/python3.9/site-packages/setuptools_scm/_integration/pyproject_reading.py", line 36, in read_pyproject
      section = defn.get("tool", {})[tool_name]
  KeyError: 'setuptools_scm'
  running bdist_wheel
  running build
  running build_py
  creating build/lib.linux-x86_64-cpython-39/xmlsec
  copying src/xmlsec/__init__.pyi -> build/lib.linux-x86_64-cpython-39/xmlsec
  copying src/xmlsec/constants.pyi -> build/lib.linux-x86_64-cpython-39/xmlsec
  copying src/xmlsec/template.pyi -> build/lib.linux-x86_64-cpython-39/xmlsec
  copying src/xmlsec/tree.pyi -> build/lib.linux-x86_64-cpython-39/xmlsec
  copying src/xmlsec/py.typed -> build/lib.linux-x86_64-cpython-39/xmlsec
  running build_ext
  building 'xmlsec' extension
  creating build/temp.linux-x86_64-cpython-39/tmp/tmp1wtqzv7k/xmlsec-1.3.13/src
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DOPENSSL_NO_SSL3 -fPIC -DXMLSEC_CRYPTO_DYNAMIC_LOADING=1 -D__XMLSEC_FUNCTION__=__func__ -DXMLSEC_NO_FTP=1 -DXMLSEC_NO_HTTP=1 -DXMLSEC_NO_MD5=1 -DXMLSEC_NO_RIPEMD160=1 -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_GOST2012=1 -DXMLSEC_DL_LIBLTDL=1 -DMODULE_NAME=xmlsec -DMODULE_VERSION=1.3.13 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -I/tmp/tmp3rr37sfq/.venv/lib/python3.9/site-packages/lxml/includes -I/tmp/tmp3rr37sfq/.venv/lib/python3.9/site-packages/lxml -I/tmp/tmp3rr37sfq/.venv/lib/python3.9/site-packages/lxml/includes/libxml -I/tmp/tmp3rr37sfq/.venv/lib/python3.9/site-packages/lxml/includes/extlibs -I/tmp/tmp3rr37sfq/.venv/lib/python3.9/site-packages/lxml/includes/libexslt -I/tmp/tmp3rr37sfq/.venv/lib/python3.9/site-packages/lxml/includes/libxslt -I/tmp/tmp3rr37sfq/.venv/include -I/home/gbaraujosouza/.pyenv/versions/3.9.20/include/python3.9 -c /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.c -o build/temp.linux-x86_64-cpython-39/tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.o -g -std=c99 -fPIC -fno-strict-aliasing -Wno-error=declaration-after-statement -Werror=implicit-function-declaration -Os
  In file included from /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.c:10:
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.c: In function ‘PyXmlSec_ConstantsModule_Init’:
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.c:304:51: error: ‘xmlSecSoap11Ns’ undeclared (first use in this function); did you mean ‘xmlSecEnc11Ns’?
    304 |     tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \
        |                                                   ^~~~~~
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/common.h:21:23: note: in definition of macro ‘DO_JOIN2’
     21 | #define DO_JOIN2(X,Y) X##Y
        |                       ^
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/common.h:19:19: note: in expansion of macro ‘DO_JOIN1’
     19 | #define JOIN(X,Y) DO_JOIN1(X,Y)
        |                   ^~~~~~~~
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.c:304:46: note: in expansion of macro ‘JOIN’
    304 |     tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \
        |                                              ^~~~
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.c:319:5: note: in expansion of macro ‘PYXMLSEC_ADD_NS_CONSTANT’
    319 |     PYXMLSEC_ADD_NS_CONSTANT(Soap11Ns, "SOAP11");
        |     ^~~~~~~~~~~~~~~~~~~~~~~~
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.c:304:51: note: each undeclared identifier is reported only once for each function it appears in
    304 |     tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \
        |                                                   ^~~~~~
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/common.h:21:23: note: in definition of macro ‘DO_JOIN2’
     21 | #define DO_JOIN2(X,Y) X##Y
        |                       ^
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/common.h:19:19: note: in expansion of macro ‘DO_JOIN1’
     19 | #define JOIN(X,Y) DO_JOIN1(X,Y)
        |                   ^~~~~~~~
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.c:304:46: note: in expansion of macro ‘JOIN’
    304 |     tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \
        |                                              ^~~~
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.c:319:5: note: in expansion of macro ‘PYXMLSEC_ADD_NS_CONSTANT’
    319 |     PYXMLSEC_ADD_NS_CONSTANT(Soap11Ns, "SOAP11");
        |     ^~~~~~~~~~~~~~~~~~~~~~~~
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.c:304:51: error: ‘xmlSecSoap12Ns’ undeclared (first use in this function); did you mean ‘xmlSecXPath2Ns’?
    304 |     tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \
        |                                                   ^~~~~~
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/common.h:21:23: note: in definition of macro ‘DO_JOIN2’
     21 | #define DO_JOIN2(X,Y) X##Y
        |                       ^
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/common.h:19:19: note: in expansion of macro ‘DO_JOIN1’
     19 | #define JOIN(X,Y) DO_JOIN1(X,Y)
        |                   ^~~~~~~~
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.c:304:46: note: in expansion of macro ‘JOIN’
    304 |     tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \
        |                                              ^~~~
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.c:320:5: note: in expansion of macro ‘PYXMLSEC_ADD_NS_CONSTANT’
    320 |     PYXMLSEC_ADD_NS_CONSTANT(Soap12Ns, "SOAP12");
        |     ^~~~~~~~~~~~~~~~~~~~~~~~
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.c:433:31: error: ‘xmlSecKeyDataEcdsaId’ undeclared (first use in this function); did you mean ‘xmlSecKeyDataDsaId’?
    433 |     tmp = PyXmlSec_KeyDataNew(xmlSec ## name ## Id); \
        |                               ^~~~~~
  /tmp/tmp1wtqzv7k/xmlsec-1.3.13/src/constants.c:450:5: note: in expansion of macro ‘PYXMLSEC_ADD_KEYDATA_CONSTANT’
    450 |     PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataEcdsa, "ECDSA")
        |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  error: command '/usr/bin/gcc' failed with exit code 1


  at ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/chef.py:164 in _prepare
      160│
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│
      163│             if error is not None:
    → 164│                 raise error from None
      165│
      166│             return path
      167│
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

I'm using arch (btw ☝️🤓) and found solutions to other distros like Ubuntu in here: https://stackoverflow.com/questions/638 … ip-command
And also solution to users that uses homebrew (which is not my case) in here: https://stackoverflow.com/questions/760 … 8#76018398

It was reported a similar issue in this post but without poetry and using an old version of python(2.7)
I tried to install the dependencies mentioned and follow the sugestions on the thread, but still no solution.

Activity

  1. ReedGraff commented on Mar 4, 2025

    @ReedGraff

    CFBR

  2. KrawczowaKris commented on Mar 4, 2025

    @KrawczowaKris

    we use paketo buildpack and get the same error with xmlsec
    this PR says that #327 is resolved, but I don't see any wheels for the python 3.13 on the pypi
    could you release them please?

  3. augbog commented on Mar 20, 2025

    @augbog

    Jesus okay well I hope this works for ya'll. I just spent the last 2 hours figuring this out. For context, I'm on pyenv venv3.8.

    This comment has an update in that same thread you mentioned. You still have to edit the libxmlsec1.rb file and and brew install --formula directly on the file. Make sure you actually uninstalled libxmlsec1 even if you have to --force.

    Biggest change in that comment is openssl@1.1 is deprecated so it renames the references to openssl@3. Make sure you have openssl@3 installed. Upon running poetry install you'll likely run into this error.

      - Installing xmlsec (1.3.13): Failed
    
      ChefBuildError
    
      Backend subprocess exited when trying to invoke build_wheel
      
      WARNING setuptools_scm.pyproject_reading toml section missing 'pyproject.toml does not contain a tool.setuptools_scm section'
      Traceback (most recent call last):
        File "/var/folders/pf/hm1yn1212l75w61jfzbm30p80000gp/T/tmp2rzm266t/.venv/lib/python3.8/site-packages/setuptools_scm/_integration/pyproject_reading.py", line 36, in read_pyproject
          section = defn.get("tool", {})[tool_name]
      KeyError: 'setuptools_scm'
      running bdist_wheel
      running build
      running build_py
      creating build/lib.macosx-15.3-arm64-cpython-38/xmlsec
      copying src/xmlsec/tree.pyi -> build/lib.macosx-15.3-arm64-cpython-38/xmlsec
      copying src/xmlsec/__init__.pyi -> build/lib.macosx-15.3-arm64-cpython-38/xmlsec
      copying src/xmlsec/constants.pyi -> build/lib.macosx-15.3-arm64-cpython-38/xmlsec
      copying src/xmlsec/template.pyi -> build/lib.macosx-15.3-arm64-cpython-38/xmlsec
      copying src/xmlsec/py.typed -> build/lib.macosx-15.3-arm64-cpython-38/xmlsec
      running build_ext
      building 'xmlsec' extension
      creating build/temp.macosx-15.3-arm64-cpython-38/private/var/folders/pf/hm1yn1212l75w61jfzbm30p80000gp/T/tmp1tildka8/xmlsec-1.3.13/src
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -DOPENSSL_NO_SSL3 -I/opt/homebrew/opt/libxmlsec1/include -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.13 -I/opt/homebrew/Cellar/libxmlsec1/1.2.37/include/xmlsec1 -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/openssl@1.1/include/openssl -I/var/folders/pf/hm1yn1212l75w61jfzbm30p80000gp/T/tmp2rzm266t/.venv/lib/python3.8/site-packages/lxml/includes -I/var/folders/pf/hm1yn1212l75w61jfzbm30p80000gp/T/tmp2rzm266t/.venv/lib/python3.8/site-packages/lxml -I/var/folders/pf/hm1yn1212l75w61jfzbm30p80000gp/T/tmp2rzm266t/.venv/include -I/Users/augustus/.pyenv/versions/3.8.19/include/python3.8 -c /private/var/folders/pf/hm1yn1212l75w61jfzbm30p80000gp/T/tmp1tildka8/xmlsec-1.3.13/src/constants.c -o build/temp.macosx-15.3-arm64-cpython-38/private/var/folders/pf/hm1yn1212l75w61jfzbm30p80000gp/T/tmp1tildka8/xmlsec-1.3.13/src/constants.o -g -std=c99 -fPIC -fno-strict-aliasing -Wno-error=declaration-after-statement -Werror=implicit-function-declaration -Os
      In file included from /private/var/folders/pf/hm1yn1212l75w61jfzbm30p80000gp/T/tmp1tildka8/xmlsec-1.3.13/src/constants.c:11:
      In file included from /private/var/folders/pf/hm1yn1212l75w61jfzbm30p80000gp/T/tmp1tildka8/xmlsec-1.3.13/src/constants.h:16:
      In file included from /opt/homebrew/Cellar/libxmlsec1/1.2.37/include/xmlsec1/xmlsec/crypto.h:28:
      /opt/homebrew/Cellar/libxmlsec1/1.2.37/include/xmlsec1/xmlsec/openssl/app.h:12:10: fatal error: 'openssl/pem.h' file not found
         12 | #include <openssl/pem.h>
            |          ^~~~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
    

    For this I had to make sure I set the following flags

    export LDFLAGS="-L$(brew --prefix openssl@3)/lib"
    export CPPFLAGS="-I$(brew --prefix openssl@3)/include"
    export PKG_CONFIG_PATH="$(brew --prefix openssl@3)/lib/pkgconfig"
    

    After that I was able to get it working. Idk if it matters, but I github cloned the actual repo, git checkout 1.3.13, and then pip install from the source.

  4. g4borg commented on Apr 25, 2025

    @g4borg

    After that I was able to get it working. Idk if it matters, but I github cloned the actual repo, git checkout 1.3.13, and then pip install from the source.

    I did not do this, and I used 1.3.13 as well (although with uv not poetry), however while it compiled with replacing openssl in the rb file, during runtime it tried to access libcrypto.1.1.dylib and failed anyway

    what did end up working for me, from this hint on stackoverflow: https://stackoverflow.com/a/79550606/1584383

    so installing with --no-binary=xmlsec
    and afterwards reinstalling lxml as well with no-binary
    this seemed to work with latest brew install xmlsec1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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