Question

I'm deployng a Django app to heroku, which requires ffmpeg. To accomplish this I am using heroku-buildpack-multi to install both heroku-buildpack-ffmpeg and heroku-buildpack-python, and all of that works fine. The problem is my that app also depends on django-pylibmc-sasl, python-memcached, pylibmc et al. which, as per usual, heroku senses and automatically installs libmemcached for me.

Here's where something goes a little wrong. If I remove the custom buildpack everything runs fine (except for ffmpeg obviously). As soon as I add it in, however, while I can run ffmpeg, python fails on import pylibmc (or rather on import _pylibmc inside the module itself). After a amount of head-scratching I decided to have a look at the environment variables, here's what I got:

With only the Python buildpack enabled:

LD_LIBRARY_PATH=/app/.heroku/vendor/lib

With both the Python and the ffmpeg buildpacks enabled:

LD_LIBRARY_PATH=:vendor/ffmpeg/lib

It looks like one or both of the buildpacks simply overwrites the other, or avoids setting the variable should it be already set. The ffmpeg buildpack seems to set LD_LIBRARY_PATH in a way that looks kosher to me, while the Python buildpack does a few things that I don't really understand the reason for.

Solution

Anyway, after manually overriding the library path using heroku config:set LD_LIBRARY_PATH=/app/.heroku/vendor/lib:vendor/ffmpeg/lib I am able to use both libmemcached and ffmpeg, but it doesn't feel too robust. What if something changes in one of the buildpacks path settings, or I add another buildpack - then I would have to manually edit the library path variable.

Better solution?

So, while this is not really an urgent question at all, I simply would like to know:

  • Is there a better way of solving this issue?
  • Might I have made some configuration error leading up to the path conflict?
  • Should this be considered a bug in either of the buildpacks?
Was it helpful?

Solution

From a quick glance at the code this may be an issue with heroku-buildpack-python. Look at your ~/.profile (heroku run bash) and look where LD_LIBRARY_PATH is set. My guess is you'll see ffmpeg's first, and then see Python's setting overriding it.

If that's the case you should file a bug.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top