Error installing 'topicmodels' package, no

2020-03-12 03:28发布

问题:

On Ubuntu 14.04, trusty:

install.packages('topicmodels')

Error message:

compilation terminated.
make: *** [ctm.o] Error 1
ERROR: compilation failed for package ‘topicmodels’
* removing ‘/home/.../R/x86_64-pc-linux-gnu-library/3.1/topicmodels’

The downloaded source packages are in
    ‘/tmp/Rtmp1L79dj/downloaded_packages’
Warning message:
In install.packages("topicmodels") :
  installation of package ‘topicmodels’ had **non-zero exit status**

回答1:

I found out that on two of my Ubuntu installations, the non-zero exit status was caused by not having the gsl package. However, it took me quite sometime before I could figure out which version would cure the error.

In the terminal: sudo apt-get install libgsl0-dev



回答2:

In this version of topicmodels, the build script contains the wrong file name:

install.packages("topicmodels")
Installing package into ‘/home/ga/R/x86_64-pc-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/topicmodels_0.2-6.tar.gz'
...
g++ -std=c++11 -shared -L/usr/lib/R/lib -L/usr/lib/x86_64-linux-gnu -lgsl -lglscblas -o topicmodels.so cokus.o common.o ctm.o dataset.o gsl-wrappers.o inference.o init.o lda-alpha.o lda-inference.o lda-model.o model.o rGibbslda.o rctm.o rlda.o utilities.o utils.o -L/usr/lib/x86_64-linux-gnu -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -lglscblas