微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

R:无法从 GitHub 安装“treeshap”

如何解决R:无法从 GitHub 安装“treeshap”

我使用的是 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

有人可以告诉我我做错了什么吗?

谢谢

解决方法

错误:编译包“treeshap”失败

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

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

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?