zenpoy zenpoy - 3 months ago 21x
Python Question

How to install scikit-learn on heroku cedar?

I'v successfully installed numpy and scipy using the method described in this answer. Then I wanted to add scikit-learn so at first I tried adding

to the requirements.txt and when pushed to heroku I got an error message:

ImportError: liblapack.so.3gf: cannot open shared object file: No such file or directory

So I've added to
the path where I have
but then I got this:

ImportError: libgfortran.so.3: cannot open shared object file: No such file or directory

I believe that heroku doesn't have fortran compiler, but maybe I wrong. How can I resolve this?


Based on these pointers, I just finished an installation of scikit-learn on heroku. I was quite happy to see that there is no need to get custom binaries, but that setting some environments did the trick :)

You can find the additional custom step in my fork of the buildpack of wyn: https://github.com/ToonTimbermont/heroku-buildpack-python

The key was to set the proper values for LD_LIBRARY_PATH: export LD_LIBRARY_PATH=$(pwd)/vendor/lib:$(pwd)/vendor/lib/atlas- base:$(pwd)/vendor/lib/atlas-base/atlas

I also added these paths to the heroku config: heroku config:add LD_LIBRARY_PATH=/app/.heroku/vendor/lib/atlas-base/atlas:/app/.heroku/vendor/lib/atlas-base:/app/.heroku/vendor/lib/