Krystian Cybulski
Krystian Cybulski

Reputation: 11108

Installing pysaml2 with pip - the xmlsec1 requirement

Is it possible to automatically install the xmlsec1 requirement of PySAML2 using pip?

The current project requires many packages and all are installed using pip and a requirements.txt file. I am now starting a SAML SSO implementation and need to install PySAML2. However, all the docs state that xmlsec1 needs to be installed as a requirement, and the pip install did not install it.

Is it possible to install xmlsec1 using pip? I see that PIL and pycrypto can successfully install external libs, so I am wondering as to why xmlsec1 cannot be installed using pip as part of PySAML2 dependencies.

Upvotes: 2

Views: 3511

Answers (2)

Aidan
Aidan

Reputation: 4250

Getting python3-saml or PySAML2 up and running on Heroku will require some extra legwork: both packages depends on python-xmlsec which depends on headers from the xmlsec1-dev linux package to install correctly.

First you will need to add the apt buildpack to your build server:

heroku buildpacks:set --index=1 -a your-app https://github.com/ABASystems/heroku-buildpack-apt
heroku buildpacks:set --index=2 -a your-app https://github.com/ABASystems/heroku-buildpack-python

You can confirm the buildpacks have been added in the correct order with heroku buildpacks -a your-app, you should see the apt buildpack first followed by the python buildpack.

Then add an Aptfile into the root of your repository containing the libxmlsec1-dev package, the file should look like:

libxmlsec1-dev

Finally, add python3-saml to your requrements.txt and git push to trigger a build.

Upvotes: 1

Boycott Russia
Boycott Russia

Reputation: 12107

Someone would need to create a pypi package containing a xmlsec1 binary. Such package doesn't exist yet because it's:

  1. quite unnatural - xmlsec1 is C application, not a python lib
  2. hard - it has to be cross platform which is more hassle in C apps than in Python
  3. python bindings should be written around xmlsec1 for a package to be at least somewhat relevant to pypi.

It shouldn't be impossible, and I'd love to be able to type "pip install xmlsec1" and see it doing all hard work. Unfortunately so far noone bothered implementing it.

Upvotes: 0

Related Questions