簡體   English   中英

在 R 中安裝最新版本的 xgboost 時出錯

[英]Error while installing the latest version of xgboost in R

嗨,嘗試時遇到以下錯誤

    `install.packages("xgboost")`

錯誤信息:

`In file included from amalgamation/xgboost-all0.cc:68:0:
 amalgamation/../src/learner.cc: In member function ‘virtual void 
 xgboost::LearnerImpl::SaveModel(xgboost::Json*) const’:
 amalgamation/../src/learner.cc:378:24: error: invalid initialization of non-const reference of type 
 ‘xgboost::Json&’ from an rvalue of type ‘<brace-enclosed initializer list>’
 Json& out { *p_out };
                    ^
 amalgamation/../src/learner.cc: In member function ‘virtual void 
 xgboost::LearnerImpl::SaveConfig(xgboost::Json*) const’:
 amalgamation/../src/learner.cc:441:24: error: invalid initialization of non-const reference of type 
 ‘xgboost::Json&’ from an rvalue of type ‘<brace-enclosed initializer list>’
 Json& out { *p_out };
                    ^
 make: *** [amalgamation/xgboost-all0.o] Error 1
 ERROR: compilation failed for package ‘xgboost’`

─ Session 資料 ──────────────────────────────────────────── ────────────────────────────────

setting  value                       
version  R version 3.6.0 (2019-04-26)
os       Red Hat Enterprise Linux    
system   x86_64, linux-gnu           
ui       RStudio                     
language (EN)                        
collate  en_AU.UTF-8                 
ctype    en_AU.UTF-8                 
tz       Australia/Brisbane          
date     2020-06-08  

但是,可以安裝較舊的存檔版本

packageurl <- "http://cran.r- 
project.org/src/contrib/Archive/xgboost/xgboost_0.90.0.2.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

If you're building from source, perhaps it would be worth trying the dev package from github via the command line ( https://xgboost.readthedocs.io/en/latest/build.html#installing-the-development-version ) :

git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
git submodule init
git submodule update
mkdir build
cd build
cmake .. -DR_LIB=ON
make -j$(nproc)
make install

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM