SAML-Toolkits / python3-saml

MIT License
704 stars 309 forks source link

Can't install python3-saml on macos #374

Closed fadilparves closed 1 year ago

fadilparves commented 1 year ago

Hi,

I have installed brew install libxml2 and brew install libxmlsec1 and then I did pip install python3-saml but then i get the error below


  Using cached python3_saml-1.15.0-py3-none-any.whl (76 kB)
Requirement already satisfied: lxml!=4.7.0,>=4.6.5 in /Users/mohamadfadil/opt/anaconda3/envs/civil-py/lib/python3.8/site-packages (from python3-saml) (4.9.3)
Collecting xmlsec>=1.3.9
  Using cached xmlsec-1.3.13.tar.gz (64 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting isodate>=0.6.1
  Using cached isodate-0.6.1-py2.py3-none-any.whl (41 kB)
Requirement already satisfied: six in /Users/mohamadfadil/opt/anaconda3/envs/civil-py/lib/python3.8/site-packages (from isodate>=0.6.1->python3-saml) (1.14.0)
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
  ╰─> [81 lines of output]
      ERROR setuptools_scm._integration.setuptools pyproject.toml does not contain a tool.setuptools_scm section
      Traceback (most recent call last):
        File "/private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-build-env-e8sh697z/overlay/lib/python3.8/site-packages/setuptools_scm/_integration/pyproject_reading.py", line 53, in read_pyproject
          section = defn.get("tool", {})[tool_name]
      KeyError: 'setuptools_scm'

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "/private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-build-env-e8sh697z/overlay/lib/python3.8/site-packages/setuptools_scm/_integration/setuptools.py", line 121, in infer_version
          config = _config.Configuration.from_file(dist_name=dist_name)
        File "/private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-build-env-e8sh697z/overlay/lib/python3.8/site-packages/setuptools_scm/_config.py", line 128, in from_file
          pyproject_data = _read_pyproject(name, _load_toml=_load_toml)
        File "/private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-build-env-e8sh697z/overlay/lib/python3.8/site-packages/setuptools_scm/_integration/pyproject_reading.py", line 55, in read_pyproject
          raise LookupError(f"{name} does not contain a tool.{tool_name} section") from e
      LookupError: pyproject.toml does not contain a tool.setuptools_scm section
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-x86_64-cpython-38
      creating build/lib.macosx-10.9-x86_64-cpython-38/xmlsec
      copying src/xmlsec/py.typed -> build/lib.macosx-10.9-x86_64-cpython-38/xmlsec
      copying src/xmlsec/tree.pyi -> build/lib.macosx-10.9-x86_64-cpython-38/xmlsec
      copying src/xmlsec/__init__.pyi -> build/lib.macosx-10.9-x86_64-cpython-38/xmlsec
      copying src/xmlsec/constants.pyi -> build/lib.macosx-10.9-x86_64-cpython-38/xmlsec
      copying src/xmlsec/template.pyi -> build/lib.macosx-10.9-x86_64-cpython-38/xmlsec
      running build_ext
      building 'xmlsec' extension
      creating build/temp.macosx-10.9-x86_64-cpython-38
      creating build/temp.macosx-10.9-x86_64-cpython-38/private
      creating build/temp.macosx-10.9-x86_64-cpython-38/private/var
      creating build/temp.macosx-10.9-x86_64-cpython-38/private/var/folders
      creating build/temp.macosx-10.9-x86_64-cpython-38/private/var/folders/60
      creating build/temp.macosx-10.9-x86_64-cpython-38/private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn
      creating build/temp.macosx-10.9-x86_64-cpython-38/private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T
      creating build/temp.macosx-10.9-x86_64-cpython-38/private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_
      creating build/temp.macosx-10.9-x86_64-cpython-38/private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_/xmlsec_edef75468ce94446856b4e96a9676e4d
      creating build/temp.macosx-10.9-x86_64-cpython-38/private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_/xmlsec_edef75468ce94446856b4e96a9676e4d/src
      gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/mohamadfadil/opt/anaconda3/envs/civil-py/include -arch x86_64 -I/Users/mohamadfadil/opt/anaconda3/envs/civil-py/include -arch x86_64 -D__XMLSEC_FUNCTION__=__func__ -DXMLSEC_NO_FTP=1 -DXMLSEC_NO_MD5=1 -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/usr/local/Cellar/libxmlsec1/1.3.1_1/include/xmlsec1 -I/usr/local/opt/openssl@3/include -I/usr/local/opt/openssl@3/include/openssl -I/private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-build-env-e8sh697z/overlay/lib/python3.8/site-packages/lxml/includes -I/private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-build-env-e8sh697z/overlay/lib/python3.8/site-packages/lxml -I/private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-build-env-e8sh697z/overlay/lib/python3.8/site-packages/lxml/includes/__pycache__ -I/Users/mohamadfadil/opt/anaconda3/envs/civil-py/include/python3.8 -c /private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_/xmlsec_edef75468ce94446856b4e96a9676e4d/src/constants.c -o build/temp.macosx-10.9-x86_64-cpython-38/private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_/xmlsec_edef75468ce94446856b4e96a9676e4d/src/constants.o -g -std=c99 -fPIC -fno-strict-aliasing -Wno-error=declaration-after-statement -Werror=implicit-function-declaration -Os
      /private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_/xmlsec_edef75468ce94446856b4e96a9676e4d/src/constants.c:319:5: error: use of undeclared identifier 'xmlSecSoap11Ns'
          PYXMLSEC_ADD_NS_CONSTANT(Soap11Ns, "SOAP11");
          ^
      /private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_/xmlsec_edef75468ce94446856b4e96a9676e4d/src/constants.c:304:46: note: expanded from macro 'PYXMLSEC_ADD_NS_CONSTANT'
          tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \
                                                   ^
      /private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_/xmlsec_edef75468ce94446856b4e96a9676e4d/src/common.h:19:19: note: expanded from macro 'JOIN'
      #define JOIN(X,Y) DO_JOIN1(X,Y)
                        ^
      /private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_/xmlsec_edef75468ce94446856b4e96a9676e4d/src/common.h:20:23: note: expanded from macro 'DO_JOIN1'
      #define DO_JOIN1(X,Y) DO_JOIN2(X,Y)
                            ^
      /private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_/xmlsec_edef75468ce94446856b4e96a9676e4d/src/common.h:21:23: note: expanded from macro 'DO_JOIN2'
      #define DO_JOIN2(X,Y) X##Y
                            ^
      <scratch space>:43:1: note: expanded from here
      xmlSecSoap11Ns
      ^
      /private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_/xmlsec_edef75468ce94446856b4e96a9676e4d/src/constants.c:320:5: error: use of undeclared identifier 'xmlSecSoap12Ns'; did you mean 'xmlSecXPath2Ns'?
          PYXMLSEC_ADD_NS_CONSTANT(Soap12Ns, "SOAP12");
          ^
      /private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_/xmlsec_edef75468ce94446856b4e96a9676e4d/src/constants.c:304:46: note: expanded from macro 'PYXMLSEC_ADD_NS_CONSTANT'
          tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \
                                                   ^
      /private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_/xmlsec_edef75468ce94446856b4e96a9676e4d/src/common.h:19:19: note: expanded from macro 'JOIN'
      #define JOIN(X,Y) DO_JOIN1(X,Y)
                        ^
      /private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_/xmlsec_edef75468ce94446856b4e96a9676e4d/src/common.h:20:23: note: expanded from macro 'DO_JOIN1'
      #define DO_JOIN1(X,Y) DO_JOIN2(X,Y)
                            ^
      /private/var/folders/60/1yz0pnwd2jv15p28bffgz8p40000gn/T/pip-install-vrpm7_l_/xmlsec_edef75468ce94446856b4e96a9676e4d/src/common.h:21:23: note: expanded from macro 'DO_JOIN2'
      #define DO_JOIN2(X,Y) X##Y
                            ^
      <scratch space>:45:1: note: expanded from here
      xmlSecSoap12Ns
      ^
      /usr/local/Cellar/libxmlsec1/1.3.1_1/include/xmlsec1/xmlsec/strings.h:34:33: note: 'xmlSecXPath2Ns' declared here
      XMLSEC_EXPORT_VAR const xmlChar xmlSecXPath2Ns[];
                                      ^
      2 errors generated.
      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: Could not build wheels for xmlsec, which is required to install pyproject.toml-based projects ```

Any idea how to install it? 
lazorchakp commented 1 year ago

This is most likely related to https://github.com/xmlsec/python-xmlsec/issues/254

fadilparves commented 1 year ago

If anyone facing the same issue in future, the fix is to downgrade libxmlsec1 library for macos from 1.3 to 1.2.7. I tried the above method shared by @lazorchakp but for some reason it did not work. But this method I found in other issue thread worked for me https://github.com/xmlsec/python-xmlsec/issues/254