Preventing the python and ffmpeg heroku buildpacks from overwriting LD_LIBRARY_PATH

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?

Answers


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.


Need Your Help

How to normalize ranked data in scikit learn?

python algorithm machine-learning artificial-intelligence scikit-learn

I am doing some machine learning and need help with one aspect of my coding. In my training data, I have a number of URLs of webpages and some features for these webpages. I am running TF-IDF on th...

Set preffered listen address in weblogic 11g

linux networking dns redhat weblogic11g

I have a WebLogic 11g domain with 1 admin server and 4 managed servers running on 2 machines. Each machine has 3 ip addresses, but only one of those addresses is seen by another machine. Each machi...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.