0

Rにおいて、Light GBMパッケージをインストールしようとしたところ、以下のようなメッセージとともにエラーが出ました。参考にしたサイトは
http://kato-kohaku-0.hatenablog.com/entry/2018/08/29/004250
です。色々エラーの原因を調べてみたところ、どうやらCMakeかVisual Studioのエラーらしいのですが、再インストールなどをしたところで何も変わらず、はまってしまいました。どうすればこのエラーを解決できるのでしょう。

> library(devtools)
 要求されたパッケージ usethis をロード中です 
> devtools::install_github("Laurae2/lgbdl",force = T)
Downloading GitHub repo Laurae2/lgbdl@master
√  checking for file 'C:\Users\trueR\AppData\Local\Temp\Rtmp02qreU\remotes33802b302749\Laurae2-lgbdl-b369192/DESCRIPTION' (546ms)
-  preparing 'lgbdl':
√  checking DESCRIPTION meta-information ... 
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  building 'lgbdl_0.0.0.9000.tar.gz'

Installing package into ‘C:/Users/trueR/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package 'lgbdl' ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'lgbdl'
    finding HTML links ...  完了 
    lgb.dl                                  html  
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (lgbdl)
> lgbdl::lgb.dl(commit = "master",
+               compiler = "vs", # Remove this for MinGW + GPU installation
+               repo = "https://github.com/Microsoft/LightGBM",
+               cores = 4,
+               use_gpu = TRUE)
C:\Users\trueR\Documents>C:

C:\Users\trueR\Documents>cd C:\Users\trueR\AppData\Local\Temp\Rtmp02qreU 

C:\Users\trueR\AppData\Local\Temp\Rtmp02qreU>git clone --recursive https://github.com/Microsoft/LightGBM 
Cloning into 'LightGBM'...
Updating files: 100% (342/342), done.
Submodule 'include/boost/compute' (https://github.com/boostorg/compute) registered for path 'compute'
Cloning into 'C:/Users/trueR/AppData/Local/Temp/Rtmp02qreU/LightGBM/compute'...
Submodule path 'compute': checked out '36c89134d4013b2e5e45bc55656a18bd6141995a'

C:\Users\trueR\AppData\Local\Temp\Rtmp02qreU>cd LightGBM 

C:\Users\trueR\AppData\Local\Temp\Rtmp02qreU\LightGBM>git checkout master 
Your branch is up to date with 'origin/master'.
Already on 'master'

C:\Users\trueR\AppData\Local\Temp\Rtmp02qreU\LightGBM>cp -r C:\Users\trueR\AppData\Local\Temp\Rtmp02qreU/LightGBM/compute/include/boost C:\Users\trueR\AppData\Local\Temp\Rtmp02qreU/LightGBM/include/boost 
Installing package into ‘C:/Users/trueR/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package 'lightgbm' ...
** using staged installation
** libs
installing via 'install.libs.R' to C:/Users/trueR/Documents/R/win-library/3.6/00LOCK-lightgbm_r/00new/lightgbm
-- The C compiler identification is MSVC 19.23.28106.4
-- The CXX compiler identification is MSVC 19.23.28106.4
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -openmp (found version "2.0") 
-- Found OpenMP_CXX: -openmp (found version "2.0") 
-- Found OpenMP: TRUE (found version "2.0")  
-- Looking for CL_VERSION_2_2
-- Looking for CL_VERSION_2_2 - not found
-- Looking for CL_VERSION_2_1
-- Looking for CL_VERSION_2_1 - found
-- Found OpenCL: C:/Program Files (x86)/Intel/OpenCL SDK/7.0/lib/x64/OpenCL.lib (found version "2.1") 
-- OpenCL include directory: C:/Program Files (x86)/Intel/OpenCL SDK/7.0/include
CMake Warning (dev) at CMakeLists.txt:100 (find_package):
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Environment variable Boost_ROOT is set to:

    C:\local\boost_1_71_0

  For compatibility, CMake is ignoring the variable.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find Boost (missing: filesystem system) (found suitable version
  "1.71.0", minimum required is "1.56.0")
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.16/Modules/FindBoost.cmake:2162 (find_package_handle_standard_args)
  CMakeLists.txt:100 (find_package)


-- Configuring incomplete, errors occurred!
See also "C:/Users/trueR/AppData/Local/Temp/Rtmp02qreU/LightGBM/lightgbm_r/src/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/trueR/AppData/Local/Temp/Rtmp02qreU/LightGBM/lightgbm_r/src/build/CMakeFiles/CMakeError.log".
CMake Error at CMakeLists.txt:7 (PROJECT):
  Generator

    Visual Studio 15 2017

  could not find any instance of Visual Studio.



-- Configuring incomplete, errors occurred!
See also "C:/Users/trueR/AppData/Local/Temp/Rtmp02qreU/LightGBM/lightgbm_r/src/build/CMakeFiles/CMakeOutput.log".
-- Selecting Windows SDK version  to target Windows 10.0.18362.
CMake Error at CMakeLists.txt:7 (PROJECT):
  Failed to run MSBuild command:

    MSBuild.exe

  to get the value of VCTargetsPath:

    謖・ョ壹&繧後◆繝輔ぃ繧、繝ォ縺瑚ヲ九▽縺九j縺セ縺帙s縲・


-- Configuring incomplete, errors occurred!
See also "C:/Users/trueR/AppData/Local/Temp/Rtmp02qreU/LightGBM/lightgbm_r/src/build/CMakeFiles/CMakeOutput.log".
CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/CMakeMinGWFindMake.cmake:12 (message):
  sh.exe was found in your PATH, here:

  C:/Rtools/bin/sh.exe

  For MinGW make to work correctly sh.exe must NOT be in your path.

  Run cmake from a shell that does not have sh.exe in your PATH.

  If you want to use a UNIX shell, then use MSYS Makefiles.

Call Stack (most recent call first):
  CMakeLists.txt:7 (PROJECT)


CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
-- The C compiler identification is GNU 4.9.3
-- The CXX compiler identification is GNU 4.9.3
-- Check for working C compiler: C:/Rtools/mingw_64/bin/gcc.exe
-- Check for working C compiler: C:/Rtools/mingw_64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Rtools/mingw_64/bin/g++.exe
-- Check for working CXX compiler: C:/Rtools/mingw_64/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -fopenmp (found version "4.0") 
-- Found OpenMP_CXX: -fopenmp (found version "4.0") 
-- Found OpenMP: TRUE (found version "4.0")  
-- Looking for CL_VERSION_2_2
-- Looking for CL_VERSION_2_2 - not found
-- Looking for CL_VERSION_2_1
-- Looking for CL_VERSION_2_1 - found
-- Found OpenCL: C:/Windows/System32/OpenCL.DLL (found version "2.1") 
-- OpenCL include directory: C:/Program Files (x86)/Intel/OpenCL SDK/7.0/include
CMake Warning (dev) at CMakeLists.txt:100 (find_package):
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Environment variable Boost_ROOT is set to:

    C:\local\boost_1_71_0

  For compatibility, CMake is ignoring the variable.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find Boost (missing: filesystem system) (found suitable version
  "1.71.0", minimum required is "1.56.0")
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.16/Modules/FindBoost.cmake:2162 (find_package_handle_standard_args)
  CMakeLists.txt:100 (find_package)


-- Configuring incomplete, errors occurred!
See also "C:/Users/trueR/AppData/Local/Temp/Rtmp02qreU/LightGBM/lightgbm_r/src/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/trueR/AppData/Local/Temp/Rtmp02qreU/LightGBM/lightgbm_r/src/build/CMakeFiles/CMakeError.log".
MINGW3~1.EXE: *** No rule to make target '_lightgbm'.  Stop.
 eval(ei, envir) でエラー: Cannot find lib_lightgbm.dll
* removing 'C:/Users/trueR/Documents/R/win-library/3.6/lightgbm'
[1] FALSE
Warning message:
In install.packages(file.path(lgb_git_dir, "LightGBM", "lightgbm_r"),  :
  installation of package ‘C:/Users/trueR/AppData/Local/Temp/Rtmp02qreU/LightGBM/lightgbm_r’ had non-zero exit status

1 件の回答 1

0
  to get the value of VCTargetsPath:

    謖・ョ壹&繧後◆繝輔ぃ繧、繝ォ縺瑚ヲ九▽縺九j縺セ縺帙s縲・

どこかのパスが文字化けしている事が原因かと思います。
別の行では正しく日本語が吐かれているので、どこかで混在してしまっていますね

MINGW3~1.EXE: *** No rule to make target '_lightgbm'.  Stop.
 eval(ei, envir) でエラー:

Windows環境、特に日本語Windows環境でUnix由来のコードを動かすのは相当たいへんです...

「環境を作ることそのもの」が目的なのでなければ、rocker/tidyverse の docker イメージを使われる事を強くオススメ致します。

docker for windowsをインストールしたら、ターミナルから

docker run -p 8787:8787 rocker/tidyverse

と実行するだけで環境が整います。
(ローカルのRStudioも、内部的にはWebアプリと同じなので使い心地はほぼ同じです)

この質問に回答するには、ログインする必要があります。

求めていた回答ではありませんか? のタグが付いた他の質問を参照する。