无法在Windows 7上安装具有GPU支持的R XGBoost

时间:2018-06-29 20:51:49

标签: r installation xgboost

我尝试在Windows 7的R中安装具有GPU支持的XGBoost。我按照此处的安装指南(http://xgboost.readthedocs.io/en/latest/build.html#installing-r-package-with-gpu-support)进行操作,直到最后一步都很好。我花了几天的时间搜索,找不到解决方案。有人可以帮我吗?

这是我在Git Bash中遵循的过程:

git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
git submodule init
git submodule update
mkdir build
cd build
cmake .. -G"Visual Studio 14 2015 Win64" -DUSE_CUDA=ON -DR_LIB=ON -DLIBR_EXECUTABLE="C:/Program Files/R/R-3.4.1/bin/x64/R.exe"
cmake --build . --target install --config Release

在最后一步找到以下错误

"C:\Users\geng\xgboost\build\install.vcxproj" (default target) (1) ->
(PostBuildEvent target) ->
  EXEC : warning : running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-
34~1.2/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-34~1.2/share/make/winshlib.mk" SHL
IB="xgboost.dll" WIN=64 TCLBIN=64 OBJECTS=""' had status 127 [C:\Users\geng\xgb
oost\build\install.vcxproj]


"C:\Users\geng\xgboost\build\install.vcxproj" (default target) (1) ->
(PostBuildEvent target) ->
  EXEC : error : compilation failed for package 'xgboost' [C:\Users\geng\xgboos
t\build\install.vcxproj]
  C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.ta
rgets(133,5): error MSB3073: The command "setlocal\r [C:\Users\geng\xgboost\bui
ld\install.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targ
ets(133,5): error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -DBUILD_TYPE=
Release -P cmake_install.cmake\r [C:\Users\geng\xgboost\build\install.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targ
ets(133,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd\r [C:\Users\geng\x
gboost\build\install.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targ
ets(133,5): error MSB3073: :cmEnd\r [C:\Users\geng\xgboost\build\install.vcxpro
j]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targ
ets(133,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :c
mDone\r [C:\Users\geng\xgboost\build\install.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targ
ets(133,5): error MSB3073: :cmErrorLevel\r [C:\Users\geng\xgboost\build\install
.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targ
ets(133,5): error MSB3073: exit /b %1\r [C:\Users\geng\xgboost\build\install.vc
xproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targ
ets(133,5): error MSB3073: :cmDone\r [C:\Users\geng\xgboost\build\install.vcxpr
oj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targ
ets(133,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd\r [C:\Users\geng\x
gboost\build\install.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targ
ets(133,5): error MSB3073: :VCEnd" exited with code -1. [C:\Users\geng\xgboost\
build\install.vcxproj]

    166 Warning(s)
    2 Error(s)

如果我改为执行此命令(cmake --build . --target xgboost --config Release),则没有错误。但是,我不知道从这里应该怎么做。如果我只是做这样的事情:

cd R-package
"C:/Program Files/R/R-3.4.2/bin/R.exe" CMD INSTALL .

它以另一个不同的错误结尾,如下所示。我不知道我做错了什么,非常感谢您的帮助。提前非常感谢您!

geng@g20user MINGW64 ~/xgboost/build/R-package (master)
$ "C:/Program Files/R/R-3.4.2/bin/R.exe" CMD INSTALL .
* installing to library 'C:/Users/geng/Documents/R/win-library/3.4'
* installing *source* package 'xgboost' ...
** libs

*** arch - i386
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-34~1.2/etc/
i386/Makeconf" -f "C:/PROGRA~1/R/R-34~1.2/share/make/winshlib.mk" SHLIB="xgboost
.dll" OBJECTS=""' had status 127
ERROR: compilation failed for package 'xgboost'
* removing 'C:/Users/geng/Documents/R/win-library/3.4/xgboost'

1 个答案:

答案 0 :(得分:0)

没关系,我找出了原因。这与我的Rtools设置有关。我重新安装它,并确保PATH包含以下两项,然后问题已解决。

c:\ Rtools \ bin; c:\ Rtools \ mingw_64 \ bin