Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
520 views
in Technique[技术] by (71.8m points)

r - Error in installing "TopicModels" package in google collab

Since I need more computational resources, I started running my R code on google collab. 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 Collab:

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?

question from:https://stackoverflow.com/questions/65851441/error-in-installing-topicmodels-package-in-google-collab

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...