简体   繁体   English

无法在 R 中安装插入符号包(在我的 Linux 机器中)

[英]Can't install the caret package in R (in my Linux machine)

I am facing the following errors while trying to install the caret package in R.我在尝试在 R 中安装插入符号包时遇到以下错误。

     g++: error: /tmp/Rtmp2Tos7n/R.INSTALL2e6e30153a74/nloptr/nlopt-2.4.2/lib/libnlopt_cxx.a: 
No such file or directory make: *** [nloptr.so] Error 1
    
    ERROR: compilation failed for package ‘nloptr’
    * removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/nloptr’
    Warning in install.packages :
      installation of package ‘nloptr’ had non-zero exit status
    ERROR: dependency ‘nloptr’ is not available for package ‘lme4’
    * removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/lme4’
    Warning in install.packages :
      installation of package ‘lme4’ had non-zero exit status
    ERROR: dependency ‘lme4’ is not available for package ‘pbkrtest’
    * removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/pbkrtest’
    Warning in install.packages :
      installation of package ‘pbkrtest’ had non-zero exit status
    ERROR: dependency ‘lme4’ is not available for package ‘BradleyTerry2’
    * removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/BradleyTerry2’
    Warning in install.packages :
      installation of package ‘BradleyTerry2’ had non-zero exit status
    ERROR: dependency ‘pbkrtest’ is not available for package ‘car’
    * removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/car’
    Warning in install.packages :
      installation of package ‘car’ had non-zero exit status
    ERROR: dependencies ‘car’, ‘BradleyTerry2’ are not available for package ‘caret’
    * removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/caret’
    Warning in install.packages :
      installation of package ‘caret’ had non-zero exit status
    
    The downloaded source packages are in
        ‘/tmp/RtmpG9dYqn/downloaded_packages’

I looked into this other question that had a similar problem我调查了另一个有类似问题的问题

Dependency issue while installing caret package in R 在 R 中安装插入符号包时的依赖性问题

The solution for this problem was to install each of the dependencies first, but they all had the same error message.此问题的解决方案是先安装每个依赖项,但它们都有相同的错误消息。 For example:例如:

>install.packages('nloptr')

g++: error: /tmp/RtmpgEn54A/R.INSTALL7015350f0d03/nloptr/nlopt-2.4.2/lib/libnlopt_cxx.a: No such file or directory
make: *** [nloptr.so] Error 1
ERROR: compilation failed for package ‘nloptr’
* removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/nloptr’
Warning in install.packages :
  installation of package ‘nloptr’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpG9dYqn/downloaded_packages’

I also tried changing the repos ie.我也尝试更改repos即。 install.packages('caret', repos='http://cran.rstudio.com/') but it dint work either. install.packages('caret', repos='http://cran.rstudio.com/')但它也不能工作。

My session info is given below:我的会话信息如下:

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-suse-linux-gnu (64-bit)

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

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

loaded via a namespace (and not attached):
[1] tools_3.1.2

I was hoping to add a comment first.我希望先添加评论。 On Jan 28, 2015, there was an addition to the nloptr package in github that possibly broke the compilation. 2015 年 1 月 28 日,github 中的 nloptr 包中添加了一个可能破坏编译的内容。 I used a workaround by installing from an older version with the command我通过使用命令从旧版本安装来使用解决方法

install.packages("http://cran.r-project.org/src/contrib/Archive/nloptr/nloptr_1.0.0.tar.gz",
                 repos=NULL, type="source")

I recently encountered the problem with nlopt as well.我最近也遇到了 nlopt 的问题。 It was easily solved by installing nlopt-devel and its associated dependencies from YaST (or your preferred package manager).通过从 YaST(或您首选的包管理器)安装nlopt-devel及其相关的依赖项,它很容易解决。

As mentioned in this R help forum:正如这个 R 帮助论坛中提到的:

http://r.789695.n4.nabble.com/can-t-install-rugarch-and-nloptr-packages-in-R-3-01-opensuse-linux-td4669649.html http://r.789695.n4.nabble.com/can-t-install-rugarch-and-nloptr-packages-in-R-3-01-opensuse-linux-td4669649.html

add the line to the src/Makevars file将该行添加到 src/Makevars 文件

     mv .libs lib; \

between之间

     make install; \
     ls | grep -v ^include$$ | grep -v ^lib$$ | xargs rm -rf; \

This will remove the compilation error and you would be able to install nloptr package.这将消除编译错误,您将能够安装 nloptr 包。 I have tested this for nloptr_1.0.0.tar.gz .我已经为 nloptr_1.0.0.tar.gz 测试了这个。

I solve this issue by installing first "car" from synaptic (use filter with "cran-car").我通过从突触安装第一个“汽车”来解决这个问题(使用带有“cran-car”的过滤器)。 And then I install "caret" with rstudio but I guess it will work also for R. Hope it helps, Regards然后我用 rstudio 安装“插入符号”,但我想它也适用于 R。希望它有所帮助,问候

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

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