Vendoring dependencies in python CF app

795 views
Skip to first unread message

Josh Ghiloni

unread,
Feb 16, 2015, 3:55:27 PM2/16/15
to vcap-dev
Hi folks,

I'm currently working on a small app in Python that will need to have its dependencies vendored, as it will be running in an offline environment. The buildpack says to run "pip install" to install to a vendored directory, but that hasn't been working for me. I'm a bit of a Python noob, so I'm flailing a bit, trying to figure out what needs to go into my vendor directory. I will need some compiled modules, like cryptography. Can those be vendored as well? 

Any suggestions are welcome. 
Thanks!

Josh Ghiloni

unread,
Feb 16, 2015, 5:02:10 PM2/16/15
to vcap...@cloudfoundry.org
I thought, heck, the easiest way to figure it out would be to just give it a shot, right? Well, I copied all my dependencies from my virtualenv's lib/python2.6/site-packages directory to vendor/cache, and the buildpack is still trying to download them.

Daniel Mikusa

unread,
Feb 17, 2015, 10:02:50 AM2/17/15
to vcap...@cloudfoundry.org
On Mon, Feb 16, 2015 at 3:55 PM, Josh Ghiloni <ghi...@gmail.com> wrote:
Hi folks,

I'm currently working on a small app in Python that will need to have its dependencies vendored, as it will be running in an offline environment. The buildpack says to run "pip install" to install to a vendored directory, but that hasn't been working for me.

That doesn't work for me either.  `pip install` just says `You must give at least one requirement to install (see "pip help install")`.  

I haven't tested this, but I think you want to run `pip install --download vendor -r requirements.txt` instead.  That'll download the source files for the required libraries into the `vendor` directory, which you can push with you app.  That looks to be what the test fixture is doing [1].

 
I'm a bit of a Python noob, so I'm flailing a bit, trying to figure out what needs to go into my vendor directory. I will need some compiled modules, like cryptography. Can those be vendored as well? 

I think this is what the build pack is doing, just pre-downloading the source packages.  It would still install & compile things server side, so I think compiled modules should work fine.

 
Dan



Any suggestions are welcome. 
Thanks!

--
You received this message because you are subscribed to the Google Groups "Cloud Foundry Developers" group.
To view this discussion on the web visit https://groups.google.com/a/cloudfoundry.org/d/msgid/vcap-dev/CAMdgCYvwbKkzhd7A_5bynbKGuYrektCx9vrMWHz84KSm-MQZTw%40mail.gmail.com.

To unsubscribe from this group and stop receiving emails from it, send an email to vcap-dev+u...@cloudfoundry.org.

Josh Ghiloni

unread,
Feb 17, 2015, 10:14:56 AM2/17/15
to vcap...@cloudfoundry.org
Awesome, thanks! I'll give that a shot and report back.

Josh Ghiloni

unread,
Feb 17, 2015, 2:55:03 PM2/17/15
to vcap...@cloudfoundry.org
That did the trick exactly! Definitely never would have gotten there, as it was downloading tarballs. :) Thanks for the help.

Daniel Mikusa

unread,
Feb 17, 2015, 3:03:28 PM2/17/15
to vcap...@cloudfoundry.org
Fantastic!  I opened an issue to correct the docs.

Dan

JT Archie

unread,
Feb 19, 2015, 10:26:48 AM2/19/15
to vcap...@cloudfoundry.org, dmi...@pivotal.io
Documentation has been updated.

Thanks for the help.

JT
Reply all
Reply to author
Forward
0 new messages