Centos,如何在R上安装“topicmodels”包?

Centos,如何在R上安装“topicmodels”包?

我在笔记本电脑上使用 Linux CentOS 版本 6.6,并且尝试将“topicmodels”包安装到我的 R 环境中。

所以我使用了 install.packages("topicmodels") 命令,但不幸的是它不起作用。

以下是我收到的日志消息:

    * installing *source* package ‘topicmodels’ ...
** package ‘topicmodels’ successfully unpacked and MD5 sums checked
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c cokus.c -o cokus.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c common.c -o common.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c ctm.c -o ctm.o
ctm.c:29:25: error: gsl/gsl_rng.h: No such file or directory
ctm.c:30:28: error: gsl/gsl_vector.h: No such file or directory
ctm.c:31:28: error: gsl/gsl_matrix.h: No such file or directory
In file included from ctm.c:33:
gsl-wrappers.h:32: warning: type defaults to ‘int’ in declaration of ‘gsl_vector’
gsl-wrappers.h:32: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
gsl-wrappers.h:33: error: expected ‘)’ before ‘*’ token
gsl-wrappers.h:34: error: expected ‘)’ before ‘*’ token
gsl-wrappers.h:35: warning: type defaults to ‘int’ in declaration of ‘gsl_matrix’
gsl-wrappers.h:35: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
gsl-wrappers.h:36: error: expected ‘)’ before ‘*’ token
gsl-wrappers.h:37: error: expected ‘)’ before ‘*’ token
gsl-wrappers.h:38: error: expected ‘)’ before ‘*’ token
gsl-wrappers.h:39: warning: type defaults to ‘int’ in declaration of ‘gsl_vector’
gsl-wrappers.h:39: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
gsl-wrappers.h:40: warning: type defaults to ‘int’ in declaration of ‘gsl_matrix’
gsl-wrappers.h:40: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
gsl-wrappers.h:41: error: expected declaration specifiers or ‘...’ before ‘gsl_vector’
gsl-wrappers.h:42: error: expected declaration specifiers or ‘...’ before ‘gsl_matrix’
gsl-wrappers.h:43: error: expected declaration specifiers or ‘...’ before ‘gsl_vector’
gsl-wrappers.h:44: error: expected declaration specifiers or ‘...’ before ‘gsl_matrix’
gsl-wrappers.h:45: error: expected ‘)’ before ‘*’ token
gsl-wrappers.h:46: error: expected ‘)’ before ‘*’ token
gsl-wrappers.h:47: error: expected ‘)’ before ‘*’ token
gsl-wrappers.h:48: error: expected ‘)’ before ‘*’ token
gsl-wrappers.h:49: error: expected ‘)’ before ‘*’ token
gsl-wrappers.h:50: warning: type defaults to ‘int’ in declaration of ‘gsl_vector’
gsl-wrappers.h:50: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
gsl-wrappers.h:51: error: expected ‘)’ before ‘*’ token
gsl-wrappers.h:52: error: expected ‘)’ before ‘*’ token
gsl-wrappers.h:53: error: expected ‘)’ before ‘*’ token
In file included from ctm.c:34:
ctm.h:40: error: expected specifier-qualifier-list before ‘gsl_matrix’
ctm.h:55: error: expected specifier-qualifier-list before ‘gsl_matrix’
ctm.c: In function ‘new_llna_model’:
ctm.c:45: error: ‘llna_model’ has no member named ‘mu’
ctm.c:45: warning: implicit declaration of function ‘gsl_vector_calloc’
ctm.c:46: error: ‘llna_model’ has no member named ‘cov’
ctm.c:46: warning: implicit declaration of function ‘gsl_matrix_calloc’
ctm.c:47: error: ‘llna_model’ has no member named ‘inv_cov’
ctm.c:48: error: ‘llna_model’ has no member named ‘log_beta’
ctm.c: In function ‘new_llna_ss’:
ctm.c:62: error: ‘llna_ss’ has no member named ‘mu_ss’
ctm.c:63: error: ‘llna_ss’ has no member named ‘cov_ss’
ctm.c:64: error: ‘llna_ss’ has no member named ‘beta_ss’
ctm.c:64: error: ‘llna_model’ has no member named ‘log_beta’
ctm.c:65: error: ‘llna_ss’ has no member named ‘ndata’
ctm.c: In function ‘del_llna_ss’:
ctm.c:73: warning: implicit declaration of function ‘gsl_vector_free’
ctm.c:73: error: ‘llna_ss’ has no member named ‘mu_ss’
ctm.c:74: warning: implicit declaration of function ‘gsl_matrix_free’
ctm.c:74: error: ‘llna_ss’ has no member named ‘cov_ss’
ctm.c:75: error: ‘llna_ss’ has no member named ‘beta_ss’
ctm.c: In function ‘reset_llna_ss’:
ctm.c:81: warning: implicit declaration of function ‘gsl_matrix_set_all’
ctm.c:81: error: ‘llna_ss’ has no member named ‘beta_ss’
ctm.c:82: error: ‘llna_ss’ has no member named ‘cov_ss’
ctm.c:83: warning: implicit declaration of function ‘gsl_vector_set_all’
ctm.c:83: error: ‘llna_ss’ has no member named ‘mu_ss’
ctm.c:84: error: ‘llna_ss’ has no member named ‘ndata’
ctm.c: In function ‘write_ss’:
ctm.c:90: error: ‘llna_ss’ has no member named ‘cov_ss’
ctm.c:90: error: too many arguments to function ‘printf_matrix’
ctm.c:91: error: ‘llna_ss’ has no member named ‘beta_ss’
ctm.c:91: error: too many arguments to function ‘printf_matrix’
ctm.c:92: error: ‘llna_ss’ has no member named ‘mu_ss’
ctm.c:92: error: too many arguments to function ‘printf_vector’
ctm.c: In function ‘corpus_init’:
ctm.c:103: error: ‘gsl_rng’ undeclared (first use in this function)
ctm.c:103: error: (Each undeclared identifier is reported only once
ctm.c:103: error: for each function it appears in.)
ctm.c:103: error: ‘r’ undeclared (first use in this function)
ctm.c:103: warning: implicit declaration of function ‘gsl_rng_alloc’
ctm.c:103: error: ‘gsl_rng_taus’ undeclared (first use in this function)
ctm.c:108: warning: implicit declaration of function ‘gsl_rng_set’
ctm.c:113: warning: implicit declaration of function ‘vset’
ctm.c:113: error: ‘llna_model’ has no member named ‘mu’
ctm.c:114: warning: implicit declaration of function ‘mset’
ctm.c:114: error: ‘llna_model’ has no member named ‘cov’
ctm.c:116: warning: implicit declaration of function ‘matrix_inverse’
ctm.c:116: error: ‘llna_model’ has no member named ‘cov’
ctm.c:116: error: ‘llna_model’ has no member named ‘inv_cov’
ctm.c:117: error: ‘llna_model’ has no member named ‘log_det_inv_cov’
ctm.c:117: warning: implicit declaration of function ‘log_det’
ctm.c:117: error: ‘llna_model’ has no member named ‘inv_cov’
ctm.c:126: warning: implicit declaration of function ‘gsl_rng_uniform’
ctm.c:131: warning: implicit declaration of function ‘minc’
ctm.c:131: error: ‘llna_model’ has no member named ‘log_beta’
ctm.c:135: error: ‘llna_model’ has no member named ‘log_beta’
ctm.c:137: error: ‘llna_model’ has no member named ‘log_beta’
ctm.c:139: warning: implicit declaration of function ‘mget’
ctm.c:139: error: ‘llna_model’ has no member named ‘log_beta’
ctm.c:143: error: ‘llna_model’ has no member named ‘log_beta’
ctm.c:145: error: ‘llna_model’ has no member named ‘log_beta’
ctm.c:146: error: ‘llna_model’ has no member named ‘log_beta’
ctm.c:149: warning: implicit declaration of function ‘gsl_rng_free’
ctm.c: In function ‘random_init’:
ctm.c:164: error: ‘gsl_rng’ undeclared (first use in this function)
ctm.c:164: error: ‘r’ undeclared (first use in this function)
ctm.c:164: error: ‘gsl_rng_taus’ undeclared (first use in this function)
ctm.c:170: error: ‘llna_model’ has no member named ‘mu’
ctm.c:171: error: ‘llna_model’ has no member named ‘cov’
ctm.c:180: error: ‘llna_model’ has no member named ‘log_beta’
ctm.c:183: error: ‘llna_model’ has no member named ‘log_beta’
ctm.c:183: error: ‘llna_model’ has no member named ‘log_beta’
ctm.c:185: error: ‘llna_model’ has no member named ‘cov’
ctm.c:185: error: ‘llna_model’ has no member named ‘inv_cov’
ctm.c:186: error: ‘llna_model’ has no member named ‘log_det_inv_cov’
ctm.c:186: error: ‘llna_model’ has no member named ‘inv_cov’
ctm.c: In function ‘write_llna_model’:
ctm.c:207: error: ‘llna_model’ has no member named ‘log_beta’
ctm.c:212: error: ‘llna_model’ has no member named ‘mu’
ctm.c:212: error: too many arguments to function ‘printf_vector’
ctm.c:214: error: ‘llna_model’ has no member named ‘cov’
ctm.c:214: error: too many arguments to function ‘printf_matrix’
ctm.c:216: error: ‘llna_model’ has no member named ‘inv_cov’
ctm.c:216: error: too many arguments to function ‘printf_matrix’
ctm.c:219: error: ‘llna_model’ has no member named ‘log_det_inv_cov’
ctm.c:224: error: ‘llna_model’ has no member named ‘log_beta’
ctm.c:224: error: too many arguments to function ‘printf_matrix’
make: *** [ctm.o] Error 1
ERROR: compilation failed for package ‘topicmodels’
* removing ‘/usr/lib64/R/library/topicmodels’

The downloaded source packages are in
    ‘/tmp/RtmpnduiXI/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:

在 install.packages("topicmodels") 中:包“topicmodels”的安装具有非零退出状态

以下是我的 R 版本的详细信息:

平台 x86_64-redhat-linux-gnu arch x86_64
os linux-gnu 系统 x86_64,linux-gnu 状态 Major 3 Minor 1.2
年 2014 年 月 10
天 31 svn rev 66913
语言 R version.string R 版本 3.1.2 (2014-10-31 ) 绰号南瓜头盔

你知道为什么我无法在 R 中安装这个包吗?你能给我一些解决这个问题的建议吗?

答案1

您至少需要安装gsl-devel,其中包含 GNU 科学库。这应该修复

ctm.c:29:25: error: gsl/gsl_rng.h: No such file or directory
ctm.c:30:28: error: gsl/gsl_vector.h: No such file or directory
ctm.c:31:28: error: gsl/gsl_matrix.h: No such file or directory

错误。

相关内容