Since I need more computational resources, I started running my R code on Google Colab. I have no problem with installing most of the packages I need, but for the "TopicModels" package when I run the code below:
install.packages('topicmodels', repos='http://cran.rstudio.com/')
I get the following error message on Google Colab:
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning message in install.packages("topicmodels", repos = "http://cran.rstudio.com/"):
“installation of package ‘topicmodels’ had non-zero exit status”
Can anyone advise how I should resolve this error?
Try running this in a code cell before the installation of the topicmodels
package.
system2('sudo', 'apt-get install libgsl0-dev')
This installs a required library in the Unix environment of Colab that you would normally install from a command prompt like this.
sudo apt-get install libgsl0-dev
In Python notebooks, you would do this.
!sudo apt-get install libgsl0-dev
But this doesn't seem to work in R notebooks so the system2
call does the work.