2

I am trying to implement SAML2.0 in my Django(version 1.7) application in Python 2.7 by using oneLogin python-saml library (https://github.com/onelogin/python-saml), but I am getting this error below:

import dm.xmlsec.binding as xmlsec
ImportError: No module named dm.xmlsec.binding

When I tried to install this specific library on my machine I am getting this error:

Collecting dm.xmlsec.binding
  Using cached https://files.pythonhosted.org/packages/56/30/7d19e02398b46593c7a72589c767c50f1ff4a96845f5bc6c61c3183fb213/dm.xmlsec.binding-2.0.tar.gz
    Complete output from command python setup.py egg_info:
    Error: cannot get XMLSec1 pre-processor and compiler flags; do you have the `libxmlsec1` development package installed?

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-W3sKpb/dm.xmlsec.binding/

Please, let me know what libraries should I use to implement SAML2 in python2.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Niraj Rathod
  • 21
  • 1
  • 2

2 Answers2

4

From the Installation section, that package has some external dependencies:

Dependencies

  • python 2.7
  • dm.xmlsec.binding Cython/lxml based binding for the XML security library (depends on python-dev libxml2-dev libxmlsec1-dev)
  • isodate An ISO 8601 date/time/duration parser and formater
  • defusedxml XML bomb protection for Python stdlib modules

For dm.xmlsec.binding, you need to install libxmlsec1-dev.

Depending on your platform:

  • Debian/Ubuntu

    $ sudo apt-get install libxmlsec1-dev
    
  • OS X (using Homebrew)

    $ brew install libxmlsec1
    

Then install the dependency

$ pip install dm.xmlsec.binding

OR

$ python -m pip install dm.xmlsec.binding

(Make sure to install it in the same python env as your application)

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
0

open terminal and hit the below command

pip install dm.xmlsec.binding