Can't install Xgb with GPU: LIBR_LIB_DIR was not set

Can’t install Xgb with GPU support. The latest try is with Visual Studio 2017, R 3.6.3, Rtools 3.5, Cmake 3.18.2. The machine is Win 10, 64x.
I have tried other combos: R 4.0.2, Rtools 4, Cmake 17.?, Visual Studio 2015, 2019. Often the error was the same as below.
In addition, I tried to install R to different locations, including the default one. I have not kept up with the exact messages but I am fairly sure that the default install location produces the same error.

command I used (omitting -DLIBR_EXECUTABLE does not help):
cmake … -G"Visual Studio 15 2017 Win64" -DUSE_CUDA=ON -DR_LIB=ON -DLIBR_EXECUTABLE=“C:\R\R363\bin\x64\R.exe” -DGPU_COMPUTE_VER=75

I have also tried this check and it’s not the problem:

c:\Users\favor\xgboost\build>“C:/R/R363/bin/x64/R.exe” --slave --no-save -e “cat(normalizePath(R.home(), winslash=’/’))”
[1] “C:/R/R363/library”
c:\Users\favor\xgboost\build>“C:/R/R363/bin/x64/R.exe” --slave --no-save -e “cat(normalizePath(R.home(),winslash=’/’))”
[1] “C:/R/R363/library”

The actual error message:

DMLC_ROOT point to C:/Users/favor/xgboost/rabit/…/dmlc-core-- LI
BR_HOME [[1] “C:/R/R363/library”
– LIBR_EXECUTABLE [C:\R\R363\bin\x64\R.exe]
– LIBR_INCLUDE_DIRS [[1] “C:/R/R363/library”
– LIBR_LIB_DIR [[1] “C:/R/R363/library”
CMake Error at cmake/modules/FindLibR.cmake:44 (message):
LIBR_LIB_DIR was not set!
Call Stack (most recent call first):
cmake/modules/FindLibR.cmake:164 (create_rlib_for_msvc)
R-package/CMakeLists.txt:1 (find_package)
– Configuring incomplete, errors occurred!

Have you looked at the instructions at You should probably set the option -DR_VERSION and -DLIBR_HOME.

1 Like

I tried -DR_VERSION - did not help. I may have tried -DLIBR_HOME at some point. I will try it tomorrow.

I does find LIBR_HOME according to the trace I posted. It appears to find LIBR_LIB_DIR as well but then complains that it did not find it. Strange.

Let’s also try setting -DLIBR_LIB_DIR to the lib directory under C:/R/R363.

1 Like

with many yellow warning messages this succeeded in installing xgboost package. unfortunately, GPU benchmark fails, but non-gpu xgboost does train a model. I will try everything again on a different machine using a different CUDA version. I have CUDA 11.0 with the latest driver and 1080ti.

additional info: xgboost gpu works for me in python where I installed it via: conda install py-xgboost-gpu

creates R-package after many yellow warnings and installs to the correct library:
cmake … -G"Visual Studio 15 2017 Win64" -DUSE_CUDA=ON -DR_LIB=ON -DLIBR_EXECUTABLE=“C:/R/R363/bin/x64” -DLIBR_LIB_DIR=“C:/R/R363/library” -DLIBR_HOME=“C:/R/R363” -DR_VERSION=3.6.3 -DGPU_COMPUTE_VER=75

cmake --build . --target xgboost --config Release --parallel

error message while running xgboost gpu benchmark:
Error in xgb.iter.update(bst$handle, dtrain, iteration - 1, obj) :
[13:42:23] C:/Users/yyyy/xgboost/src/tree/ Exception in gpu_hist: after reduction step 1: cudaErrorInvalidDeviceFunction: invalid device function

Are you using WSL? I don’t think XGBoost is yet tested with WSL.

both R and Python are on plain Windows 10 Home 18363, no WSL. I used anaconda to get python packages and then used conda to get xgboost-gpu, so easy! But I need xgb-gpu in R, ideally.

I have no idea what went wrong. It works great on my side.

Is using Linux an option for you?

Don’t really want to go to Linux at this point. I may end up using the python version.
Failed to install xgb-gpu on a different machine. Win 64 Pro, GTX 1080. I used different Cuda 10.0 and Cmake 18.2. The build went smoothly except for multiple yellow warning messages (“signed int instead of unsigned”, etc.). I don’t know if this is normal.

This machine already had xgboost installed in R. Should I have removed it? Also, it does not have the second library in /User. 55KB Xgboost.dll was installed in “C:/R/R-3.6.3/library”. Rstidio crashed while training gpu model, but I could train non-gpu model with this install.
The commands I used:
cmake … -G"Visual Studio 15 2017 Win64" -DUSE_CUDA=ON -DR_LIB=ON -DLIBR_EXECUTABLE=“C:/R/R-3.6.3/bin/x64/R.exe” -DLIBR_LIB_DIR=“C:/R/R-3.6.3/library” -DLIBR_HOME=“C:/R/R-3.6.3” -DR_VERSION=3.6.3 -DGPU_COMPUTE_VER=75
cmake --build . --target install --config Release --parallel

compute_ver 61 (NOT 75) for 1080 and 1080ti. i feel very silly. maybe i learned something useful while trying out various things. tentatively got it installed on the second machine. demo code runs fine. thank you for looking into this.

1 Like