M. F. Bostanci
M. F. Bostanci

Reputation: 87

RcppGSL install fails on Google Colab (R notebook)

install.packages("RcppGSL") results in

Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified) 
Warning message in install.packages("RcppGSL"):
“installation of package ‘RcppGSL’ had non-zero exit status”

[Edit: This is all. Colab doesn't print anything else. traceback() also returns just "No traceback available"]

on google colab.

You can open a R Notebook on Colab via new Colab R notebook

Edit 2: Solution

  1. Open a python notebook in colab. You have to run a few terminal commands which doesn't work in the R version of colab-notebooks.

  2. Run the following

!sudo apt install libgsl-dev
!pip install rpy2
%reload_ext rpy2.ipython
  1. You can now run R code in cells by putting %%R at the top of the cell:
%%R
install.packages("RcppGSL")
library(RcppGSL)
rnorm(5)

Upvotes: 1

Views: 1240

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368261

That is an incomplete post. You do not show the actual underlying error message so we cannot help you.

Mostly likely, you simply forget to install the GSL development package. On a Debian/Ubuntu system this would be via

sudo apt install libgsl-dev

but if you have such a system you can even install the prebuilt binary for RcppGSL from the OS:

sudo apt install r-cran-rcppgsl

Edit: You may also need to consult the Google Colab documentation to assert if you can in fact install other (system) packages or not. As an alternative, on RStudio Cloud (now a commercial product with limited free hours) you can install packages easily. Maybe try your code there?

Upvotes: 3

Related Questions