Installing R Gsl Package on Ubuntu

installing R gsl package on Mac

I was able to get things working (OS X Yosemite 10.10, R 3.1.1, gsl 1.16, gsl R package 1.9-10) with standard brew-installed R and gsl by manually prefixing CFLAGS and LDFLAGS with the output from gsl-config --cflags and gsl-config --libs respectively.

The following:

CFLAGS="-I/usr/local/opt/gsl/include" LDFLAGS="-L/usr/local/opt/gsl/lib -lgsl -lgslcblas" R
...
> install.packages("gsl")

worked for me.

Note that gsl-config lists the direct path to my Cellar, the paths above are brew symlinks.

R package build failing on Unix machines due to missing GSL - GNU Scientific Library

This may not have a satisfying solution via changes to your R package (I'm not sure either way). If the gsl package authors (which include a former R Core member) didn't configure it to avoid a pre-req installation of a linux package, there's probably a good reason not to.

But it may be some consolation that most R+Linux users understand that some R packages first require installing the underlying Linux libraries (eg, through apt or dnf/yum).

Primary Issue: making it easy for the users to install

Try to be super clear on the GitHub readme and the CRAN INSTALL file. The gsl package has decent CRAN directions. This leads to the following bash code:

sudo apt-get install libgsl0-dev

The best example of clear (linux pre-req package) documentation I've seen is from the curl and sf packages. sf's CRAN page lists only the human names of the 3 libraries, but the GitHub page provides the exact bash commands for three major distribution branches. The curl package does this very well too (eg, CRAN and GitHub). For example, it provides the following explanation and bash code:

Installation from source on Linux requires libcurl. On Debian or Ubuntu use libcurl4-openssl-dev:

sudo apt-get install -y libcurl-dev

Ideally your documentation would describe how do install the gsl linux package on multiple distributions.

Disclaimer: I've never developed a package that directly requires a Linux package, but I use them a lot. In case more examples would help, this doc includes a script I use to install stuff on new Ubuntu machines. Some commands were stated explicitly in the package documentation; some had little or no documentation, and required research.

edit 2018-04-07:
I encountered my new favorite example: the sys package uses a config file to produce the following message in the R console. While installing 100+ packages on a new computer, it was nice to see this direct message, and not have to track down the R package and the documentation about its dependencies.

On Debian/Ubuntu this package requires AppArmor.

Please run: sudo apt-get install libapparmor-dev

Another good one is pdftools, that also uses a config file (and is also developed by Jeroen Ooms).

Secondary Issue: installing on Travis

The userfriendly travis config file apparently installs a lot of binaries directly (including gsl), unlike the current ggstatsplot version.

Alternatively, I'm more familiar with telling travis to install the linux package, as demonstrated by curl's config file. As a bonus, this probably more closely replicates what typical users do on their own machines.

addons:
apt:
packages:
- libcurl4-openssl-dev

Follow up 2018-03-13 Indrajeet and I tweaked the travis file so it's working. Two sections were changed in the yaml file:

  1. The libgsl0-dev entry was added under the packages section (similar to the libcurl4-openssl-dev entry above).
  2. Packages were listed in the r_binary_packages section so they install as binaries. The build was timing out after 50 minutes, and now it's under 10 min. In this particular package, the r_binary_packages section was nested in the Linux part of the Travis matrix so it wouldn't interfere with his two OS X jobs on Travis.

R BayesVarSel on Ubuntu installation

I was able to recreate the error with Ubuntu 12.04.1 LTS (desktop) running in VirtualBox.
As @Dirk Eddelbuettel suggested, sudo apt-cache search libgsl produced a useful list of packages. It's not clear why that didn't work on your machine.

I installed libgsl with:

sudo apt-get install libgsl0ldbl
sudo apt-get install libgsl0-dev

Now BayesVarSel compiles and loads without error.

error Installing topicmodels in R Ubuntu

You don't have GSL installed:

sudo apt-get install gsl-bin libgsl0-dev


Related Topics



Leave a reply



Submit