Home > Mobile >  Installing Ruby GSL on Heroku
Installing Ruby GSL on Heroku

Time:10-28

We are using a the distribution gem for calculating a gamma distribution and because we specifically require the gamma quantile method, we also require gsl

https://github.com/sciruby/distribution
https://github.com/SciRuby/rb-gsl

This works fine locally but we are trying to push this to heroku and running into immediate problems.

From the looks of things, we require a gsl buildpack which are only supported up to version 1.16 of gsl. There doesn't appear to be a gsl buildpack for the current version 2.1. Installing GSL 1.16 locally appears to be really problematic and we haven't been successful doing this either.

Looking into this further, it looks like we would need to create a binary for the curret version which would need to be hosted on AWS. Seems a bit extreme for what is basically two methods.

Either, we need help building a buildpack or need an alternative to these two specific methods.

Distribution::Gamma.quantile
Distribution::Gamma::Ruby_.cdf

Any help is greatly appreciated

CodePudding user response:

The installation instructions for rb-gsl say (slightly modified for clarity):

Ruby/GSL may be installed as a Ruby Gem by simply running

gem install gsl

Note that the GSL libraries must already be installed before Ruby/GSL can be installed:

Debian/Ubuntu: libgsl0-dev

Rather than a custom buildpack, I suspect you can get away with simply depending on the gsl gem and adding the apt buildpack for the Ubuntu dependency:

  1. Add the apt buildpack early in your list of buildpacks, e.g. by running

    heroku buildpacks:add --index 1 heroku-community/apt
    
  2. Create an Aptfile in the root directory of your repository and list the Ubuntu packages you require inside it, e.g.

    libgsl0-dev
    
  3. Commit the Aptfile and redeploy

Note that the apt buildpack does not do dependency resolution. If libgsl0-dev requires other packages, you'll need to explicitly list them as well.

  • Related