【问题标题】:R: Failed to install 'treeshap' from GitHubR:无法从 GitHub 安装“treeshap”
【发布时间】:2021-03-28 02:31:59
【问题描述】:

我正在使用 R 编程语言。我正在尝试从 github 安装以下 R 库:https://rdrr.io/github/ModelOriented/treeshap/

按照本网站的说明,我复制并粘贴了以下代码来安装这个库(我在 CRAN 上找不到这个库):

install.packages("remotes")
remotes::install_github("ModelOriented/treeshap")

但是,这会产生以下消息和错误:

Downloading GitHub repo ModelOriented/treeshap@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

 1: All                                 
 2: CRAN packages only                  
 3: None                                
 4: utf8       (1.1.4  -> 1.2.1 ) [CRAN]
 5: crayon     (1.3.4  -> 1.4.1 ) [CRAN]
 6: cli        (2.2.0  -> 2.3.1 ) [CRAN]
 7: pillar     (1.4.7  -> 1.5.1 ) [CRAN]
 8: farver     (2.0.3  -> 2.1.0 ) [CRAN]
 9: tibble     (3.0.5  -> 3.1.0 ) [CRAN]
10: isoband    (0.2.3  -> 0.2.4 ) [CRAN]
11: data.table (1.13.6 -> 1.14.0) [CRAN]

Enter one or more numbers, or an empty line to skip updates:3
√  checking for file 'C:\Users\me\AppData\Local\Temp\Rtmpq27MY3\remotes6c206497de8\ModelOriented-treeshap-2845f76/DESCRIPTION' ... 
-  preparing 'treeshap':
√  checking DESCRIPTION meta-information ... 
-  cleaning src
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  building 'treeshap_0.0.1.tar.gz'
   
Installing package into ‘C:/Users/me/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package 'treeshap' ...
** using staged installation
** libs

*** arch - i386
"c:/rtools40/mingw32/bin/"g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG  -I'C:/Users/me/Documents/R/win-library/4.0/Rcpp/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o
sh: c:/rtools40/mingw32/bin/g++: No such file or directory
make: *** [C:/PROGRA~1/R/R-40~1.3/etc/i386/Makeconf:229: RcppExports.o] Error 127
ERROR: compilation failed for package 'treeshap'
* removing 'C:/Users/me/Documents/R/win-library/4.0/treeshap'
Error: Failed to install 'treeshap' from GitHub:
  (converted from warning) installation of package ‘C:/Users/me/AppData/Local/Temp/Rtmpq27MY3/file6c20c152774/treeshap_0.0.1.tar.gz’ had non-zero exit status

这里是 R 会话信息:

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252    LC_MONETARY=English_Canada.1252
[4] LC_NUMERIC=C                    LC_TIME=English_Canada.1252    

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

loaded via a namespace (and not attached):
 [1] prettyunits_1.1.1 ps_1.5.0          fansi_0.4.2       rprojroot_2.0.2   withr_2.4.1       crayon_1.3.4     
 [7] assertthat_0.2.1  R6_2.5.0          cli_2.2.0         curl_4.3          remotes_2.2.0     rstudioapi_0.13  
[13] callr_3.5.1       tools_4.0.3       glue_1.4.2        tinytex_0.30      xfun_0.21         compiler_4.0.3

谁能告诉我我做错了什么?

谢谢

【问题讨论】:

    标签: r installation exitstatus


    【解决方案1】:

    错误:包“treeshap”编译失败

    问题是编译错误。此外,我们看到:

    sh: c:/rtools40/mingw32/bin/g++: 没有那个文件或目录

    编译失败,因为找不到g++。一个好的起点是查看您的机器上是否存在c:/rtools40。如果没有,Using Rtools40 on Windows 文章可能会有所帮助。

    【讨论】:

    • 谢谢!这似乎解决了问题!
    猜你喜欢
    • 2016-11-10
    • 2020-01-06
    • 2020-03-07
    • 1970-01-01
    • 2020-09-27
    • 2020-07-23
    • 1970-01-01
    • 2019-07-31
    • 1970-01-01
    相关资源
    最近更新 更多