zenpoy zenpoy - 5 months ago 30
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

scikit-learn==0.11
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
LD_LIBRARY_PATH
the path where I have
liblapack.so.3gf
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?

Answer

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/

Comments