我要在Anaconda3上安装Xgboost,在Windows1064位上。我按照教程中https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en和https://dnc1994.com/2016/03/installing-xgboost-on-windows/的说明操作,但未能完成编译过程。
我执行了以下代码(git bash),在这个阶段一切似乎都正常:
$ git clone --recursive https://github.com/dmlc/xgboost
$ cd xgboost
$ git submodule init
$ git submodule update
然后,我安装了mingw并添加到路径:
C:\Program Files\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev2\mingw64\bin
以下指令已执行且未返回错误:
$ which mingw32-make
$ alias make='mingw32-make'
接下来我尝试执行folling命令(也是git bash),在第二步(make-j4)中出错:
$ cd dmlc-core
$ make -j4
$ cd ../rabit
$ make lib/librabit_empty.a -j4
$ cd ..
$ cp make/mingw64.mk config.mk
$ make -j4
我犯了如下错误:
$ make -j4
g++ -c -O3 -Wall -Wno-unknown-pragmas -Iinclude -std=c++0x -fPIC -DDMLC_USE_HDFS=0 -DDMLC_USE_S3=0 -DDMLC_USE_AZURE=0 -msse2 -o line_split.o src/io/line_split.cc
g++ -c -O3 -Wall -Wno-unknown-pragmas -Iinclude -std=c++0x -fPIC -DDMLC_USE_HDFS=0 -DDMLC_USE_S3=0 -DDMLC_USE_AZURE=0 -msse2 -o recordio_split.o src/io/recordio_split.cc
g++ -c -O3 -Wall -Wno-unknown-pragmas -Iinclude -std=c++0x -fPIC -DDMLC_USE_HDFS=0 -DDMLC_USE_S3=0 -DDMLC_USE_AZURE=0 -msse2 -o input_split_base.o src/io/input_split_base.cc
g++ -c -O3 -Wall -Wno-unknown-pragmas -Iinclude -std=c++0x -fPIC -DDMLC_USE_HDFS=0 -DDMLC_USE_S3=0 -DDMLC_USE_AZURE=0 -msse2 -o io.o src/io.cc
src/io/recordio_split.cc:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
src/io/input_split_base.cc:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
src/io.cc:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
src/io/line_split.cc:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
src/io/input_split_base.cc: In member function 'void dmlc::io::InputSplitBase::InitInputFileInfo(const string&)':
src/io/input_split_base.cc:112:12: warning: variable 'exact_match' set but not used [-Wunused-but-set-variable]
In file included from c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c++/4.6.3/cstdio:44:0,
from include/dmlc/io.h:8,
from src/io.cc:4:
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/include/stdio.h:396:83: error: 'FILE* std::fopen(const char*, const char*)' should have been declared inside 'std'
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/include/stdio.h:396:83: error: declaration of 'FILE* std::fopen(const char*, const char*)'
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/include/stdio.h:395:17: error: conflicts with previous declaration 'FILE* fopen(const char*, const char*)'
In file included from include/dmlc/./././parameter.h:25:0,
from include/dmlc/././registry.h:14,
from include/dmlc/./data.h:16,
from include/dmlc/threadediter.h:20,
from src/io/cached_input_split.h:16,
from src/io.cc:13:
include/dmlc/././././optional.h:31:27: error: both 'const' and 'constexpr' cannot be used here
In file included from include/dmlc/././registry.h:14:0,
from include/dmlc/./data.h:16,
from include/dmlc/threadediter.h:20,
from src/io/cached_input_split.h:16,
from src/io.cc:13:
include/dmlc/./././parameter.h: In member function 'virtual void dmlc::parameter::FieldEntry<float>::Set(void*, const string&) const':
include/dmlc/./././parameter.h:962:25: error: 'stof' is not a member of 'std'
include/dmlc/./././parameter.h: In member function 'virtual void dmlc::parameter::FieldEntry<double>::Set(void*, const string&) const':
include/dmlc/./././parameter.h:983:25: error: 'stod' is not a member of 'std'
In file included from src/io/cached_input_split.h:16:0,
from src/io.cc:13:
include/dmlc/threadediter.h: At global scope:
include/dmlc/threadediter.h:210:3: error: 'thread' in namespace 'std' does not name a type
include/dmlc/threadediter.h:216:3: error: 'mutex' in namespace 'std' does not name a type
include/dmlc/threadediter.h:222:3: error: 'condition_variable' in namespace 'std' does not name a type
include/dmlc/threadediter.h:224:3: error: 'condition_variable' in namespace 'std' does not name a type
include/dmlc/threadediter.h: In constructor 'dmlc::ThreadedIter<DType>::ThreadedIter(size_t)':
include/dmlc/threadediter.h:82:9: error: class 'dmlc::ThreadedIter<DType>' does not have any field named 'producer_thread_'
include/dmlc/threadediter.h: In member function 'virtual void dmlc::ThreadedIter<DType>::BeforeFirst()':
include/dmlc/threadediter.h:168:5: error: 'unique_lock' is not a member of 'std'
include/dmlc/threadediter.h:168:22: error: 'mutex' is not a member of 'std'
include/dmlc/threadediter.h:168:39: error: 'mutex_' was not declared in this scope
……
dmlc::threadediter::next()[具有dtype=dmlc::data::rowblockcontainer]'
src/data.cc:160:1:从此处实例化
include/dmlc/threadediter.h:387:5:错误:在此作用域中未声明“lock”
include/dmlc/threadediter.h:在成员函数“bool dmlc::threadediter::next(dtype**)[with dtype=dmlc::data::rowblockcontainer]”中:
include/dmlc/threadediter.h:151:5:从“bool dmlc::threadediter::next()[使用dtype=dmlc::data::rowblockcontainer]实例化”
src/data.cc:160:1:从此处实例化
include/dmlc/threadediter.h:362:3:错误:在此作用域中未声明“lock”
include/dmlc/threadediter.h:在成员函数“void dmlc::threadediter::recycle(dtype**)[with dtype=dmlc::data::rowblockcontainer]”中:
include/dmlc/threadediter.h:149:7:从“bool dmlc::threadediter::next()[使用dtype=dmlc::data::rowblockcontainer]实例化”
src/data.cc:160:1:从此处实例化
include/dmlc/threadediter.h:387:5:错误:在此作用域中未声明“lock”
include/dmlc/threadediter.h:在成员函数“bool dmlc::threadediter::next(dtype**)[with dtype=dmlc::data::rowblockcontainer]”中:
include/dmlc/threadediter.h:151:5:从“bool dmlc::threadediter::next()[使用dtype=dmlc::data::rowblockcontainer]实例化”
src/data.cc:160:1:从此处实例化
include/dmlc/threadediter.h:362:3:错误:在此作用域中未声明“lock”
makefile:83:目标“data.o”的配方失败
mingw32 make:**[data.o]错误1
我在谷歌上搜索了很多,似乎在anacoda3windows64上安装最新的python xgboost版本非常困难。
有人知道如何处理这个问题吗?
最佳答案
大约一个月前,XGBoost的Win64版本可以通过Conda获得。conda install py-xgboost
应该有效。