lacrosse1991
lacrosse1991

Reputation: 3162

How can I get the python xmlsec library running on Pivotal Cloud Foundry

I'm in the process of trying to get the python module python3-saml working on a cloud foundry app that is using the standard python buildpack and cflinuxfs2 stack. This module relies on the python xmlsec module as a dependency, but I'm unfortunately running into issues with getting it working.

I've put together a requirements file and have vendored all of the python dependencies, but I keep getting the following error when I go to run the "cf push" command.

            Running setup.py install for xmlsec: started
              Running setup.py install for xmlsec: finished with status 'error'
              Complete output from command /tmp/contents998689849/deps/0/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lwwtrplp/xmlsec/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-qwoda574-record/install-record.txt --single-version-externally-managed --compile:
              running install
              running build
              running build_ext
              *********************************************************************************
              Could not find xmlsec1 config. Are libxmlsec1-dev and pkg-config installed?
              *********************************************************************************

              ----------------------------------------
          Command "/tmp/contents998689849/deps/0/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lwwtrplp/xmlsec/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-qwoda574-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-lwwtrplp/xmlsec/
          pip install has failed. You have a vendor directory, it must contain all of your dependencies.
          **ERROR** Could not install pip packages: Couldn't run pip: exit status 1
   Failed to compile droplet: Failed to run all supply scripts: exit status 14
   Exit status 223

I tried uploading the appropriate libxmlsec1-dev and libxmlsec1 manually and set an environment variable to refer to them, but the staging process appears to just ignore those while it's setting up packages.

Is there anything that I could do to get this process working? I'd imagine there's a custom buildpack out there somewhere that would do the trick, but I wasn't sure if there was a way to do this using the standard python buildpack instead.

Upvotes: 1

Views: 1091

Answers (1)

Daniel Mikusa
Daniel Mikusa

Reputation: 15006

The primary option would be to vendor your dependencies. With this option, you build locally and then push all the compiled bits too. The trick is that you have to build on a compatible system, so you need an Ubuntu Trusty PC/VM/Docker container.

Follow these instructions, then run cf push & make sure that you do not have the vendor directory ignored (remove from .cfignore, if it exists).

https://docs.cloudfoundry.org/buildpacks/python/index.html#vendoring

The other option that should work is to use multi-buildpack support. With this you can push using two buildpacks. The first would be the Apt buildpack and the second would be the python buildpack. The Apt buildpack allows you to install the packages that you need, which looks like libxmlsec1-dev. The second is just the standard Python buildpack, but it will have access to what has been installed via the Apt buildpack.

You can see instructions here: https://docs.cloudfoundry.org/buildpacks/use-multiple-buildpacks.html

Upvotes: 2

Related Questions