1
>>> from zeep import Client
>>> from zeep.wsse.signature import Signature
>>> client = Client(
...     'http://www.webservicex.net/ConvertSpeed.asmx?WSDL',
...     wsse=Signature(
...         private_key_filename, public_key_filename,
...         optional_password))

I ran the code based on this official sample code above. However, I got this error below.

ImportError: The xmlsec module is required for wsse.Signature()
You can install xmlsec with: pip install xmlsec
or install zeep via: pip install zeep[xmlsec]

But, I've already installed that.

Edit:

When I put just import xmlsec I got this error below:

ImportError: dlopen(/Users/myaccount/opt/miniconda3/lib/python3.8/site-packages/xmlsec.cpython-38-darwin.so, 2):
  Symbol not found: _xmlSecDSigNs
  Referenced from: /Users/myaccount/opt/miniconda3/lib/python3.8/site-packages/xmlsec.cpython-38-darwin.so
  Expected in: flat namespace in /Users/myaccount/opt/miniconda3/lib/python3.8/site-packages/xmlsec.cpython-38-darwin.so
hoefling
  • 59,418
  • 12
  • 147
  • 194
Irene
  • 33
  • 8
  • Are you using a venv? If so, did you install the module inside the venv as well? Did you use said command to install? – JustLudo Feb 12 '21 at 07:10
  • You may also have multiple installations of Python - `pip install xmlsec` did install the package for one version (e.g. 2.7), while `python` starts an interactive shell in another (e.g. Python 3). – hoefling Feb 12 '21 at 09:04
  • When I put just import xmlsec I got this error below: ImportError: dlopen(/Users/myaccount/opt/miniconda3/lib/python3.8/site-packages/xmlsec.cpython-38-darwin.so, 2): Symbol not found: _xmlSecDSigNs Referenced from: /Users/myaccount/opt/miniconda3/lib/python3.8/site-packages/xmlsec.cpython-38-darwin.so Expected in: flat namespace in /Users/myaccount/opt/miniconda3/lib/python3.8/site-packages/xmlsec.cpython-38-darwin.so – Irene Feb 12 '21 at 13:11
  • @hoefling I checked python's version by using sys. It said 3.8.5 and xmlsec is in /Users/myacount/opt/miniconda3/lib/python3.8/site-packages (1.3.9). – Irene Feb 12 '21 at 22:30
  • @JustLudo I used jupyterlab. – Irene Feb 12 '21 at 22:30
  • @Airi it looks like the extension module was not built properly. Can you check that `libxml2`, `libxmlsec1` and `pkg-config` are installed (typically via Homebrew)? If yes, what does `otool -L $(python -c "from site import getsitepackages as f; print(f()[0])")/xmlsec.cpython-38-darwin.so` output? Is `libxmlsec1.1.dylib` listed? Also, do you have the new M1 or the Intel chip in your Mac? – hoefling Feb 13 '21 at 00:39
  • Another thing - can you reinstall with a verbose log and post it somewhere, e.g. on pastebin? You'd have to run `pip install xmlsec1 -vvv --no-cache-dir`, as `pip` has probably already cached the faulty wheel. – hoefling Feb 13 '21 at 00:50
  • @hoefling There is not libxmlsec1.1.dylib. I use apple M1. – Irene Feb 14 '21 at 12:39
  • @Airi looks like you have the same issue as in [#163](https://github.com/mehcode/python-xmlsec/issues/163). Unfortunately, I don't have access to Apple Silicon hardware right now, so I can't reproduce it. – hoefling Feb 14 '21 at 20:06
  • @hoefling I found that output below when I put ```otool -L $(python -c "from site import getsitepackages as f; print(f()[0])")/xmlsec.cpython-38-darwin.so``` Output: ```/opt/homebrew/Cellar/libxmlsec1/1.2.31: 220 files, 6.2MB ==> Caveats``` – Irene Feb 15 '21 at 02:31
  • @hoefling Plus, when I put ```this:pip install xmlsec1 -vvv --no-cache-dir```, I got this below error ERROR: Could not find a version that satisfies the requirement xmlsec1 (from versions: none) ERROR: No matching distribution found for xmlsec1 – Irene Feb 15 '21 at 03:05
  • Sorry, my fault - the command is of course `pip install xmlsec -vvv --no-cache-dir` – hoefling Feb 15 '21 at 07:47

0 Answers0