Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install xmlsec in alpine 3.18 as base image #257

Closed
mr-jadeja opened this issue May 15, 2023 · 7 comments
Closed

Unable to install xmlsec in alpine 3.18 as base image #257

mr-jadeja opened this issue May 15, 2023 · 7 comments

Comments

@mr-jadeja
Copy link

mr-jadeja commented May 15, 2023

Details

encountered an issue while attempting to build the xmlsec=1.3.11 python library in a Python:3.9-alpine Docker image. Here is the checklist we followed to install xmlsec in the Docker image: Installed dependencies: build-base, libressl, libffi-dev, libressl-dev, libxslt-dev, libxml2-dev, xmlsec-dev, xmlsec. Executed the command: pip install xmlsec=1.3.11. However, when using Alpine 3.18 as the underlying OS, I have been unable to successfully pip install xmlsec. I have confirmed that all the necessary dependencies are installed, including build-base, libressl, libffi-dev, libressl-dev, libxslt-dev, libxml2-dev, xmlsec-dev, and xmlsec. Please find the error logs below:
#0 0.862 Collecting xmlsec==1.3.11
#0 0.974   Downloading xmlsec-1.3.11.tar.gz (61 kB)
#0 0.991      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.3/61.3 kB 4.9 MB/s eta 0:00:00
#0 1.033   Installing build dependencies: started
#0 3.631   Installing build dependencies: finished with status 'done'
#0 3.635   Getting requirements to build wheel: started
#0 3.898   Getting requirements to build wheel: finished with status 'done'
#0 3.905   Installing backend dependencies: started
#0 5.630   Installing backend dependencies: finished with status 'done'
#0 5.631   Preparing metadata (pyproject.toml): started
#0 5.947   Preparing metadata (pyproject.toml): finished with status 'done'
#0 6.212 Collecting lxml>=3.8 (from xmlsec==1.3.11)
#0 6.240   Using cached lxml-4.9.2-cp39-cp39-musllinux_1_1_x86_64.whl (7.9 MB)
#0 6.292 Building wheels for collected packages: xmlsec
#0 6.294   Building wheel for xmlsec (pyproject.toml): started
#0 6.812   Building wheel for xmlsec (pyproject.toml): finished with status 'error'
#0 6.830   error: subprocess-exited-with-error
#0 6.830   
#0 6.830   × Building wheel for xmlsec (pyproject.toml) did not run successfully.
#0 6.830   │ exit code: 1
#0 6.830   ╰─> [121 lines of output]
#0 6.830       /tmp/pip-build-env-1m9iqhks/overlay/lib/python3.9/site-packages/setuptools/dist.py:755: SetuptoolsDeprecationWarning: Invalid dash-separated options
#0 6.830       !!
#0 6.830       
#0 6.830               ********************************************************************************
#0 6.830               Usage of dash-separated 'description-file' will not be supported in future
#0 6.830               versions. Please use the underscore name 'description_file' instead.
#0 6.830       
#0 6.830               By 2023-Sep-26, you need to update your project and remove deprecated calls
#0 6.830               or your builds will no longer be supported.
#0 6.830       
#0 6.830               See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
#0 6.830               ********************************************************************************
#0 6.830       
#0 6.830       !!
#0 6.830         opt = self.warn_dash_deprecation(opt, section)
#0 6.830       /tmp/pip-build-env-1m9iqhks/overlay/lib/python3.9/site-packages/setuptools/dist.py:755: SetuptoolsDeprecationWarning: Invalid dash-separated options
#0 6.830       !!
#0 6.830       
#0 6.830               ********************************************************************************
#0 6.830               Usage of dash-separated 'build-requires' will not be supported in future
#0 6.830               versions. Please use the underscore name 'build_requires' instead.
#0 6.830       
#0 6.830               By 2023-Sep-26, you need to update your project and remove deprecated calls
#0 6.830               or your builds will no longer be supported.
#0 6.830       
#0 6.830               See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
#0 6.830               ********************************************************************************
#0 6.830       
#0 6.830       !!
#0 6.830         opt = self.warn_dash_deprecation(opt, section)
#0 6.830       /tmp/pip-build-env-1m9iqhks/overlay/lib/python3.9/site-packages/setuptools/dist.py:755: SetuptoolsDeprecationWarning: Invalid dash-separated options
#0 6.830       !!
#0 6.830       
#0 6.830               ********************************************************************************
#0 6.830               Usage of dash-separated 'upload-dir' will not be supported in future
#0 6.830               versions. Please use the underscore name 'upload_dir' instead.
#0 6.830       
#0 6.830               By 2023-Sep-26, you need to update your project and remove deprecated calls
#0 6.830               or your builds will no longer be supported.
#0 6.830       
#0 6.830               See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
#0 6.830               ********************************************************************************
#0 6.830       
#0 6.830       !!
#0 6.830         opt = self.warn_dash_deprecation(opt, section)
#0 6.830       running bdist_wheel
#0 6.830       running build
#0 6.830       running build_py
#0 6.830       creating build
#0 6.830       creating build/lib.linux-x86_64-cpython-39
#0 6.830       creating build/lib.linux-x86_64-cpython-39/xmlsec
#0 6.830       copying src/xmlsec/py.typed -> build/lib.linux-x86_64-cpython-39/xmlsec
#0 6.830       copying src/xmlsec/__init__.pyi -> build/lib.linux-x86_64-cpython-39/xmlsec
#0 6.830       copying src/xmlsec/constants.pyi -> build/lib.linux-x86_64-cpython-39/xmlsec
#0 6.830       copying src/xmlsec/template.pyi -> build/lib.linux-x86_64-cpython-39/xmlsec
#0 6.830       copying src/xmlsec/tree.pyi -> build/lib.linux-x86_64-cpython-39/xmlsec
#0 6.830       running build_ext
#0 6.830       building 'xmlsec' extension
#0 6.830       creating build/temp.linux-x86_64-cpython-39
#0 6.830       creating build/temp.linux-x86_64-cpython-39/tmp
#0 6.830       creating build/temp.linux-x86_64-cpython-39/tmp/pip-install-wyw8bs9b
#0 6.830       creating build/temp.linux-x86_64-cpython-39/tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906
#0 6.830       creating build/temp.linux-x86_64-cpython-39/tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src
#0 6.830       gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DXMLSEC_CRYPTO_DYNAMIC_LOADING=1 -D__XMLSEC_FUNCTION__=__func__ -DXMLSEC_NO_FTP=1 -DXMLSEC_NO_MD5=1 -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_GOST2012=1 -DXMLSEC_DL_LIBLTDL=1 -DMODULE_NAME=xmlsec -DMODULE_VERSION=1.3.11 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -I/tmp/pip-build-env-1m9iqhks/normal/lib/python3.9/site-packages/lxml/includes -I/tmp/pip-build-env-1m9iqhks/normal/lib/python3.9/site-packages/lxml -I/tmp/pip-build-env-1m9iqhks/normal/lib/python3.9/site-packages/lxml/includes/libexslt -I/tmp/pip-build-env-1m9iqhks/normal/lib/python3.9/site-packages/lxml/includes/extlibs -I/tmp/pip-build-env-1m9iqhks/normal/lib/python3.9/site-packages/lxml/includes/libxslt -I/tmp/pip-build-env-1m9iqhks/normal/lib/python3.9/site-packages/lxml/includes/libxml -I/tmp/pip-build-env-1m9iqhks/normal/lib/python3.9/site-packages/lxml/includes/__pycache__ -I/usr/local/include/python3.9 -c /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.c -o build/temp.linux-x86_64-cpython-39/tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.o -g -std=c99 -fPIC -fno-strict-aliasing -Wno-error=declaration-after-statement -Werror=implicit-function-declaration -Os
#0 6.830       In file included from /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.c:10:
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.c: In function 'PyXmlSec_ConstantsModule_Init':
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.c:304:51: error: 'xmlSecSoap11Ns' undeclared (first use in this function); did you mean 'xmlSecEnc11Ns'?
#0 6.830         304 |     tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \
#0 6.830             |                                                   ^~~~~~
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/common.h:21:23: note: in definition of macro 'DO_JOIN2'
#0 6.830          21 | #define DO_JOIN2(X,Y) X##Y
#0 6.830             |                       ^
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/common.h:19:19: note: in expansion of macro 'DO_JOIN1'
#0 6.830          19 | #define JOIN(X,Y) DO_JOIN1(X,Y)
#0 6.830             |                   ^~~~~~~~
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.c:304:46: note: in expansion of macro 'JOIN'
#0 6.830         304 |     tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \
#0 6.830             |                                              ^~~~
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.c:319:5: note: in expansion of macro 'PYXMLSEC_ADD_NS_CONSTANT'
#0 6.830         319 |     PYXMLSEC_ADD_NS_CONSTANT(Soap11Ns, "SOAP11");
#0 6.830             |     ^~~~~~~~~~~~~~~~~~~~~~~~
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.c:304:51: note: each undeclared identifier is reported only once for each function it appears in
#0 6.830         304 |     tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \
#0 6.830             |                                                   ^~~~~~
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/common.h:21:23: note: in definition of macro 'DO_JOIN2'
#0 6.830          21 | #define DO_JOIN2(X,Y) X##Y
#0 6.830             |                       ^
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/common.h:19:19: note: in expansion of macro 'DO_JOIN1'
#0 6.830          19 | #define JOIN(X,Y) DO_JOIN1(X,Y)
#0 6.830             |                   ^~~~~~~~
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.c:304:46: note: in expansion of macro 'JOIN'
#0 6.830         304 |     tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \
#0 6.830             |                                              ^~~~
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.c:319:5: note: in expansion of macro 'PYXMLSEC_ADD_NS_CONSTANT'
#0 6.830         319 |     PYXMLSEC_ADD_NS_CONSTANT(Soap11Ns, "SOAP11");
#0 6.830             |     ^~~~~~~~~~~~~~~~~~~~~~~~
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.c:304:51: error: 'xmlSecSoap12Ns' undeclared (first use in this function); did you mean 'xmlSecXPath2Ns'?
#0 6.830         304 |     tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \
#0 6.830             |                                                   ^~~~~~
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/common.h:21:23: note: in definition of macro 'DO_JOIN2'
#0 6.830          21 | #define DO_JOIN2(X,Y) X##Y
#0 6.830             |                       ^
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/common.h:19:19: note: in expansion of macro 'DO_JOIN1'
#0 6.830          19 | #define JOIN(X,Y) DO_JOIN1(X,Y)
#0 6.830             |                   ^~~~~~~~
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.c:304:46: note: in expansion of macro 'JOIN'
#0 6.830         304 |     tmp = PyUnicode_FromString((const char*)(JOIN(xmlSec, name))); \
#0 6.830             |                                              ^~~~
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.c:320:5: note: in expansion of macro 'PYXMLSEC_ADD_NS_CONSTANT'
#0 6.830         320 |     PYXMLSEC_ADD_NS_CONSTANT(Soap12Ns, "SOAP12");
#0 6.830             |     ^~~~~~~~~~~~~~~~~~~~~~~~
#0 6.830       /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.c:450:5: warning: 'xmlSeckeyDataEcGetKlass' is deprecated [-Wdeprecated-declarations]
#0 6.830         450 |     PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataEcdsa, "ECDSA")
#0 6.830             |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#0 6.830       In file included from /usr/include/xmlsec1/xmlsec/crypto.h:25,
#0 6.830                        from /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.h:16,
#0 6.830                        from /tmp/pip-install-wyw8bs9b/xmlsec_207de542b6d1465bb40a89567b239906/src/constants.c:11:
#0 6.830       /usr/include/xmlsec1/xmlsec/app.h:89:49: note: declared here
#0 6.830          89 | XMLSEC_EXPORT XMLSEC_DEPRECATED xmlSecKeyDataId xmlSeckeyDataEcGetKlass(void);
#0 6.830             |                                                 ^~~~~~~~~~~~~~~~~~~~~~~
#0 6.830       error: command '/usr/bin/gcc' failed with exit code 1
#0 6.830       [end of output]
#0 6.830   
#0 6.830   note: This error originates from a subprocess, and is likely not a problem with pip.
#0 6.831   ERROR: Failed building wheel for xmlsec
#0 6.831 Failed to build xmlsec
#0 6.832 ERROR: Could not build wheels for xmlsec, which is required to install pyproject.toml-based projects
------
Dockerfile:24
--------------------
  22 |     # install python requirements
  23 |     RUN pip install --upgrade pip
  24 | >>> RUN pip install xmlsec==1.3.11
  25 |     # RUN pip install psutil memory_profiler
  26 |     # RUN pip install -r ./requirements.txt
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install xmlsec==1.3.11" did not complete successfully: exit code: 

I kindly request assistance in resolving this issue.

@ayakael
Copy link
Contributor

ayakael commented May 16, 2023

Alpine 3.18 uses libxmlsec v1.3.0, which is not yet supported by this project, it seems.

See #252

@lapak10
Copy link

lapak10 commented May 19, 2023

While there are many multiple ways to fix this, one easy suggestion would be try updating you base image in Dockerfile to 3.8-alpine3.10 (if running python 3.8 is fine with your project).

Other solution is, to change the Alpine Package Registry url in after the image and before doing the apk update.

You can try sharing your Dockerfile code which can help look deeper in the issue.

@tahayk
Copy link

tahayk commented May 22, 2023

@lapak10 thank you for the idea of using python:3.8-alpine3.10, it works fine.
Any ETA about a fix for this issue ?

@TheSamabo
Copy link

Hello
In the meantime if you need to build a docker image you can just add the Alpine 3.10 repository to apk repository list:
echo "https://dl-cdn.alpinelinux.org/alpine/v3.10/community/" | tee -a /etc/apk/repositories
After that just do: apk update && apk --no-cache add xmlsec=1.2.28-r0 xmlsec-dev=1.2.28-r0.
Now you should be able to install xmlsec via pip

@edantes-1845
Copy link

My working script for using xmlsec

echo "https://dl-cdn.alpinelinux.org/alpine/v3.15/community/" | tee -a /etc/apk/repositories
echo "https://dl-cdn.alpinelinux.org/alpine/v3.15/main" | tee -a /etc/apk/repositories

apk add --no-cache libxml2-dev=2.9.14-r2  xmlsec-dev=1.2.33-r0  python3-dev py3-pip

pip install xmlsec

That's it

@Fortich
Copy link

Fortich commented Mar 11, 2024

To prevent confusion, it would be helpful to explicitly state in the README that the requirements for libxmlsec1 should be below version 1.3 until this is addressed. Wouldn't you agree?

@mxamin
Copy link
Collaborator

mxamin commented Apr 18, 2024

The new release (1.3.14) is gonna work with xmlsec1 >= 1.3.x but apparantly it still has issues with xmlsec1 1.2.x. We already have an issue (#314) so I'm gonna close this one.

@mxamin mxamin closed this as completed Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants