You are not logged in.

#1 2021-05-31 12:18:00

astanwar99
Member
Registered: 2021-05-31
Posts: 14

[SOLVED] Error installing PyPI package xmlsec==1.3.3 Python2.7

I am installing this xmlsec package - https://pypi.org/project/xmlsec/ using pip 20.3.4 in virtualenv (python 2.7)

Although official pages (github and pypi) doesn't specifically include arch dependencies, still I think I have installed all of them.

I have installed:

extra/xmlsec 1.2.32-1 [installed]
community/python-xmlsec 1.3.11-1 [installed]
extra/libxml++ 3.2.3-1 [installed]
multilib/lib32-libxml2 2.9.10-4 [installed]

I am getting this error after running the pip command: (Original error is huge because of gcc commands so I am not including them)

Requirement already satisfied: pkgconfig in ./cen/lib/python2.7/site-packages (from xmlsec==1.3.3) (1.5.2)
Requirement already satisfied: lxml>=3.0 in ./cen/lib/python2.7/site-packages (from xmlsec==1.3.3) (4.0.0)
Building wheels for collected packages: xmlsec
  Building wheel for xmlsec (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/astanwar99/DevSpace/central/cen/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-E6BWHU/xmlsec/setup.py'"'"'; __file__='"'"'/tmp/pip-install-E6BWHU/xmlsec/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-y4lh42
       cwd: /tmp/pip-install-E6BWHU/xmlsec/
  Complete output (53 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'xmlsec' extension
  creating build
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/tmp
  creating build/temp.linux-x86_64-2.7/tmp/pip-install-E6BWHU
  creating build/temp.linux-x86_64-2.7/tmp/pip-install-E6BWHU/xmlsec
  creating build/temp.linux-x86_64-2.7/tmp/pip-install-E6BWHU/xmlsec/src
  gcc -pthread -fno-strict-aliasing -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fPIC -DMODULE_NAME=xmlsec -DMODULE_VERSION=1.3.3 -DXMLSEC_CRYPTO_DY.....
.
.
 In file included from /tmp/pip-install-E6BWHU/xmlsec/src/constants.c:10:
  /tmp/pip-install-E6BWHU/xmlsec/src/constants.c: In function ‘PyXmlSec_ConstantsModule_Init’:
  /tmp/pip-install-E6BWHU/xmlsec/src/constants.c:278:50: error: ‘xmlSecXkmsNs’ undeclared (first use in this function); did you mean ‘xmlSecXPathNs’?
    278 |     tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
        |                                                  ^~~~~~
  /tmp/pip-install-E6BWHU/xmlsec/src/common.h:21:23: note: in definition of macro ‘DO_JOIN2’
     21 | #define DO_JOIN2(X,Y) X##Y
        |                       ^
  /tmp/pip-install-E6BWHU/xmlsec/src/common.h:19:19: note: in expansion of macro ‘DO_JOIN1’
     19 | #define JOIN(X,Y) DO_JOIN1(X,Y)
        |                   ^~~~~~~~
  /tmp/pip-install-E6BWHU/xmlsec/src/constants.c:278:45: note: in expansion of macro ‘JOIN’
    278 |     tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
        |                                             ^~~~
  /tmp/pip-install-E6BWHU/xmlsec/src/constants.c:288:5: note: in expansion of macro ‘PYXMLSEC_ADD_NS_CONSTANT’
    288 |     PYXMLSEC_ADD_NS_CONSTANT(XkmsNs, "XKMS");
        |     ^~~~~~~~~~~~~~~~~~~~~~~~
  /tmp/pip-install-E6BWHU/xmlsec/src/constants.c:278:50: note: each undeclared identifier is reported only once for each function it appears in
    278 |     tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
        |                                                  ^~~~~~
  /tmp/pip-install-E6BWHU/xmlsec/src/common.h:21:23: note: in definition of macro ‘DO_JOIN2’
     21 | #define DO_JOIN2(X,Y) X##Y
        |                       ^
  /tmp/pip-install-E6BWHU/xmlsec/src/common.h:19:19: note: in expansion of macro ‘DO_JOIN1’
     19 | #define JOIN(X,Y) DO_JOIN1(X,Y)
        |                   ^~~~~~~~
  /tmp/pip-install-E6BWHU/xmlsec/src/constants.c:278:45: note: in expansion of macro ‘JOIN’
    278 |     tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
        |                                             ^~~~
  /tmp/pip-install-E6BWHU/xmlsec/src/constants.c:288:5: note: in expansion of macro ‘PYXMLSEC_ADD_NS_CONSTANT’
    288 |     PYXMLSEC_ADD_NS_CONSTANT(XkmsNs, "XKMS");
        |     ^~~~~~~~~~~~~~~~~~~~~~~~
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for xmlsec
  Running setup.py clean for xmlsec
Failed to build xmlsec
Installing collected packages: xmlsec
    Running setup.py install for xmlsec ... error
    ERROR: Command errored out with exit status 1:

My gcc version is 11.1.0

Now I am finding solutions to somewhat related problem but they are specific to other distros which I am not able work out on arch. That's why I am putting this question here.
Let me know if anything else is required. Thanks for all the help! smile

Last edited by astanwar99 (2021-06-03 04:29:26)

Offline

#2 2021-05-31 18:56:14

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Error installing PyPI package xmlsec==1.3.3 Python2.7

For starters, why aren't you using version 1.3.9 which supported python2?

Anyway this is an upstream bug, see https://github.com/mehcode/python-xmlsec/issues/169

Fixed in 1.3.10 which is not available for python2.

You're at the end of the line for python2, you'll need to fork it to keep it working there... but *why* do you need it specifically in python2?


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2021-06-01 03:18:27

astanwar99
Member
Registered: 2021-05-31
Posts: 14

Re: [SOLVED] Error installing PyPI package xmlsec==1.3.3 Python2.7

Its a requirement of a project (private repo) that I am trying to run. I know folks who were able to get it working on Ubuntu 18.04. Apparently they didn't face this issue.
I understand its an old project and putting effort in these kinds of issue might just not worth it. Probably I should use docker or something. But I still think I might be missing some dependency or using different version.

That aside I actually tried 1.3.9 as well. I got somewhat similar error

Collecting xmlsec==1.3.9
  Using cached xmlsec-1.3.9.tar.gz (62 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
Requirement already satisfied: lxml>=3.8 in ./cen/lib/python2.7/site-packages (from xmlsec==1.3.9) (4.0.0)
Building wheels for collected packages: xmlsec
  Building wheel for xmlsec (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
.
.
fter-statement -Werror=implicit-function-declaration -Os
  In file included from src/constants.c:10:
  src/constants.c: In function ‘PyXmlSec_ConstantsModule_Init’:
  src/constants.c:311:50: error: ‘xmlSecXkmsNs’ undeclared (first use in this function); did you mean ‘xmlSecXPathNs’?
    311 |     tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
        |                                                  ^~~~~~
  src/common.h:21:23: note: in definition of macro ‘DO_JOIN2’
     21 | #define DO_JOIN2(X,Y) X##Y
        |                       ^
  src/common.h:19:19: note: in expansion of macro ‘DO_JOIN1’
     19 | #define JOIN(X,Y) DO_JOIN1(X,Y)
        |                   ^~~~~~~~
  src/constants.c:311:45: note: in expansion of macro ‘JOIN’
    311 |     tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
        |                                             ^~~~
  src/constants.c:321:5: note: in expansion of macro ‘PYXMLSEC_ADD_NS_CONSTANT’
    321 |     PYXMLSEC_ADD_NS_CONSTANT(XkmsNs, "XKMS");
        |     ^~~~~~~~~~~~~~~~~~~~~~~~
  src/constants.c:311:50: note: each undeclared identifier is reported only once for each function it appears in
    311 |     tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
        |                                                  ^~~~~~
  src/common.h:21:23: note: in definition of macro ‘DO_JOIN2’
     21 | #define DO_JOIN2(X,Y) X##Y
        |                       ^
  src/common.h:19:19: note: in expansion of macro ‘DO_JOIN1’
     19 | #define JOIN(X,Y) DO_JOIN1(X,Y)
        |                   ^~~~~~~~
  src/constants.c:311:45: note: in expansion of macro ‘JOIN’
    311 |     tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
        |                                             ^~~~
  src/constants.c:321:5: note: in expansion of macro ‘PYXMLSEC_ADD_NS_CONSTANT’
    321 |     PYXMLSEC_ADD_NS_CONSTANT(XkmsNs, "XKMS");
        |     ^~~~~~~~~~~~~~~~~~~~~~~~
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for xmlsec
Failed to build xmlsec
ERROR: Could not build wheels for xmlsec which use PEP 517 and cannot be installed directly

I pip installed PEP517 separately.

Thanks for your time.

Last edited by astanwar99 (2021-06-01 03:21:55)

Offline

#4 2021-06-01 03:24:21

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Error installing PyPI package xmlsec==1.3.3 Python2.7

I know folks who were able to get it working on Ubuntu 18.04.

They likely had xmlsec 1.2.31 or earlier installed, before xmlSecXkmsNs got removed.

But I still think I might be missing some dependency or using different version.

Bingo!


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2021-06-01 11:04:18

astanwar99
Member
Registered: 2021-05-31
Posts: 14

Re: [SOLVED] Error installing PyPI package xmlsec==1.3.3 Python2.7

Cool. I'll try doing some sensible downgrades and see if it works. I'll update the post once I have something.

Thanks.

Offline

#6 2021-06-01 21:30:14

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Error installing PyPI package xmlsec==1.3.3 Python2.7

I'd recommend forking python-xmlsec, checking out the version before https://github.com/mehcode/python-xmlse … 0e43362a0d (which dropped python2 support), and then "git cherry-pick"ing the fix from https://github.com/mehcode/python-xmlse … cc5200d80c


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#7 2021-06-03 04:27:43

astanwar99
Member
Registered: 2021-05-31
Posts: 14

Re: [SOLVED] Error installing PyPI package xmlsec==1.3.3 Python2.7

As recommended, I checked out this commit https://github.com/mehcode/python-xmlse … e7585df1b9 (Python 2 still supported) and made the changes of this one https://github.com/mehcode/python-xmlse … cc5200d80c

Then,

 pip install . 

worked like a charm. To be honest, that was quite thrilling big_smile. Thanks again.

Offline

#8 2021-06-03 04:45:17

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Error installing PyPI package xmlsec==1.3.3 Python2.7

Great, happy to help. smile


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB