简体   繁体   English

安装R包glmnet编译出错

[英]Compilation error installing R package glmnet

I'm having trouble installing glmnet on my Linux desktop.我在 Linux 桌面上安装 glmnet 时遇到问题。 Below is the error I get when I run下面是我运行时得到的错误

R CMD INSTALL -d glmnet_4.0-2.tar.gz

I first tried install.packages("glmnet") with the same results.我首先尝试install.packages("glmnet") ,结果相同。 Ran R CMD INSTALL with -d hoping for some additional debug info.使用-d R CMD INSTALL希望获得一些额外的调试信息。

processing ‘glmnet_4.0-2.tar.gz’
a file
* installing to library ‘/home/sconoor/R/x86_64-redhat-linux-gnu-library/3.6’
* build_help_types=html
* DBG: 'R CMD INSTALL' now doing do_install()
* created lock directory ‘/home/sconoor/R/x86_64-redhat-linux-gnu-library/3.6/00LOCK-glmnet’
* installing *source* package ‘glmnet’ ...
** package ‘glmnet’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
about to run R CMD SHLIB -o glmnet.so glmnet5dpclean.f glmnet_init.c pb.c wls.f
77  -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -I/usr/lib64/gfortran/modules  -c glmnet5dpclean.f -o glmnet5dpclean.o
make: 77: Command not found
make: *** [glmnet5dpclean.o] Error 127
ERROR: compilation failed for package ‘glmnet’
* removing ‘/home/sconoor/R/x86_64-redhat-linux-gnu-library/3.6/glmnet’

For some reason R CMD INSTALL is substituting 77 where I would expect gfortran at the compilation step.出于某种原因, R CMD INSTALL77替换为我希望在编译步骤中使用gfortran地方。 I have searched for others that may have encountered this issue and haven't found any.我已经搜索了可能遇到此问题的其他人,但没有找到。 I am at a loss as to how to fix this.我不知道如何解决这个问题。 Any suggestions would be much appreciated.任何建议将不胜感激。

Here is the R version info这是R版本信息

> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C
 [3] LC_TIME=en_US.utf8        LC_COLLATE=en_US.utf8
 [5] LC_MONETARY=en_US.utf8    LC_MESSAGES=en_US.utf8
 [7] LC_PAPER=en_US.utf8       LC_NAME=C
 [9] LC_ADDRESS=C              LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.6.0

System info:系统信息:

LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.8.2003 (Core)
Release:        7.8.2003
Codename:       Core

and gcc version和 gcc 版本

gcc --version
gcc (GCC) 4.9.2

As identified by @BenBolker the problem was a mistake in the ~/.R/Makevars file.正如@BenBolker 所指出的,问题是 ~/.R/Makevars 文件中的一个错误。 I recall creating the Makevars file with a snippet copied from an SO answer on compiling StanHeaders with support for C++14.我记得创建 Makevars 文件时使用从 SO answer 复制的片段来编译支持 C++14 的 StanHeaders。 I missed the error in the definition of the make variable for the path to the fortran compiler.我错过了 fortran 编译器路径的 make 变量定义中的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM