首页 > 解决方案 > 错误:“treesnip”的包或命名空间加载失败

问题描述

尝试使用 remotes::install_github("curso-r/treesnip") 从 github 安装 treesnip 包时,出现以下错误:

remotes::install_github("curso-r/treesnip")
Downloading GitHub repo curso-r/treesnip@HEAD
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
√  checking for file 'C:\Users\SAR.V-LOG\AppData\Local\Temp\RtmpENiM7Q\remotes38701dfb49f3\curso-r-treesnip-c70a89b/DESCRIPTION' (375ms)
-  preparing 'treesnip': (736ms)
√  checking DESCRIPTION meta-information ... 
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
   Removed empty directory 'treesnip/.github/workflows'
   Removed empty directory 'treesnip/.github'
     NB: this package now depends on R (>= 3.5.0)
     WARNING: Added dependency on R >= 3.5.0 because serialized objects in  serialize/load version 3 cannot be read in older versions of R.  File(s) containing such objects:  'treesnip/inst/benchmark_parallel_processing_vignette.rds'
-  building 'treesnip_0.1.0.tar.gz'
   
* installing *source* package 'treesnip' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'treesnip'
    finding HTML links ... done
    add_boost_tree_catboost                 html  
    add_boost_tree_lightgbm                 html  
    add_decision_tree_tree                  html  
    multi_predict._catboost.Model           html  
    multi_predict._lgb.Booster              html  
    predict_lightgbm_classification_class   html  
    predict_lightgbm_classification_prob    html  
    predict_lightgbm_classification_raw     html  
    predict_lightgbm_regression_numeric     html  
    train_catboost                          html  
    train_lightgbm                          html  
    train_tree                              html  
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
*** arch - i386
Error: package or namespace load failed for 'treesnip':
 .onLoad failed in loadNamespace() for 'treesnip', details:
  call: NULL
  error: The values passed to `set_encoding()` are missing arguments: 'allow_sparse_x'
error: loading failed
running stopped
*** arch - x64
Error: package or namespace load failed for 'treesnip':
 .onLoad failed in loadNamespace() for 'treesnip', details:
  call: NULL
  error: The values passed to `set_encoding()` are missing arguments: 'allow_sparse_x'
Fejl: loading failed
running stopped
ERROR: loading failed for 'i386', 'x64'
* removing 'C:/Users/SAR.V-LOG/OneDrive - VELUX/Documents 1/R/R-4.0.2/library/treesnip'
Error: Failed to install 'treesnip' from GitHub:
  (converted from warning) installation of package ‘C:/Users/SAR~1.V-L/AppData/Local/Temp/RtmpENiM7Q/file38706c2c7239/treesnip_0.1.0.tar.gz’ had non-zero exit status

我的会话信息():

sessionInfo()

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

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

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

loaded via a namespace (and not attached):
[1] compiler_4.0.2 tools_4.0.2   

我在另一台 PC 上运行时工作正常。我还尝试将库位置更改为 C:/Users/SAR.V-LOG/,但这也无济于事。此外,我尝试提供 INSTALL_opts = "--no-test-load"。当我这样做时,安装完成但没有错误,但是当我尝试使用 library(treesnip) 加载库时,我得到同样的错误:传递给的值set_encoding()缺少参数:'allow_sparse_x'

您知道导致此错误的原因以及如何解决吗?

标签: rgithub

解决方案


treesnip 是固定的。它现在取决于欧洲防风草 (>= 0.1.3.9000) https://github.com/curso-r/treesnip/commit/902a33d9f156c10da6dbe1bd9cccb65926077197


推荐阅读