Lightgbm: Error: Please install CMake first

Created on 5 Apr 2019  路  7Comments  路  Source: microsoft/LightGBM

I want to install gpu version of lightgbm.
pip install lightgbm --install-option=--gpu
Throws an error.

Environment info

Operating System: Windows 10 64x

CPU/GPU model: i5-6600K, GTX 970

Python 3.6.6

LightGBM version : lightgbm-2.2.3

-I have CMake 3.13.4 (gui version) on my system.
-cmake version 3.13.3 in python packages
-CUDA 10.0
-boost_1_69_0
-Visual Studio 2017
-Mingw

  • I have cmake in System and User variable PATHs ( C:\Program Files\CMake\bin )

Command Prompt Error Message

PS C:\WINDOWS\system32> pip install lightgbm --install-option=--gpu
c:\users\dogus\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\commands\install.py:207: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
  cmdoptions.check_install_build_global(options)
Collecting lightgbm
  Using cached https://files.pythonhosted.org/packages/c9/ce/3aff55e25e282383c19c5a5fb7387fd400e64b1a1036671aefa63ceeaaf4/lightgbm-2.2.3.tar.gz
Requirement already satisfied: numpy in c:\users\dogus\appdata\local\programs\python\python36\lib\site-packages (from lightgbm) (1.16.2)
Requirement already satisfied: scipy in c:\users\dogus\appdata\local\programs\python\python36\lib\site-packages (from lightgbm) (1.1.0)
Requirement already satisfied: scikit-learn in c:\users\dogus\appdata\local\programs\python\python36\lib\site-packages (from lightgbm) (0.19.1)
Skipping bdist_wheel for lightgbm, due to binaries being disabled for it.
Installing collected packages: lightgbm
  Running setup.py install for lightgbm ... error
    Complete output from command c:\users\dogus\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\dogus\\AppData\\Local\\Temp\\pip-install-i06iyve7\\lightgbm\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\dogus\AppData\Local\Temp\pip-record-w25kxw_7\install-record.txt --single-version-externally-managed --compile --gpu:
    running install
    INFO:LightGBM:Starting to compile the library.
    INFO:LightGBM:Starting to compile with Visual Studio 15 2017 Win64.
    Traceback (most recent call last):
      File "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\setup.py", line 77, in silent_call
        output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
      File "c:\users\dogus\appdata\local\programs\python\python36\lib\subprocess.py", line 336, in check_output
        **kwargs).stdout
      File "c:\users\dogus\appdata\local\programs\python\python36\lib\subprocess.py", line 418, in run
        output=stdout, stderr=stderr)
    subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', '_lightgbm', '--config', 'Release']' returned non-zero exit status 1.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\setup.py", line 338, in <module>
        'Topic :: Scientific/Engineering :: Artificial Intelligence'])
      File "c:\users\dogus\appdata\local\programs\python\python36\lib\site-packages\setuptools\__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "c:\users\dogus\appdata\local\programs\python\python36\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\users\dogus\appdata\local\programs\python\python36\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "c:\users\dogus\appdata\local\programs\python\python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\setup.py", line 261, in run
        openmp_include_dir=self.openmp_include_dir, openmp_library=self.openmp_library)
      File "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\setup.py", line 165, in compile_cpp
        error_msg='Please install CMake first')
      File "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\setup.py", line 86, in silent_call
        raise Exception("\n".join((error_msg, LOG_NOTICE)))
    Exception: Please install CMake first
    The full version of error log was saved into C:\Users\dogus\LightGBM_compilation.log

Detailed error message from LightGBM_compilation.txt

-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
-- The C compiler identification is MSVC 19.16.27030.1
-- The CXX compiler identification is MSVC 19.16.27030.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/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/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/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 - not found
-- Looking for CL_VERSION_2_0
-- Looking for CL_VERSION_2_0 - not found
-- Looking for CL_VERSION_1_2
-- Looking for CL_VERSION_1_2 - found
-- Found OpenCL: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/lib/x64/OpenCL.lib (found version "1.2") 
-- OpenCL include directory:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/include
CMake Warning (dev) at CMakeLists.txt:97 (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:\boost\boost_1_69_0

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

-- Boost version: 1.69.0
-- Found the following Boost libraries:
--   filesystem
--   system
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/dogus/AppData/Local/Temp/pip-install-i06iyve7/lightgbm/build_cpp
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 4/5/2019 9:56:43 PM.
Project "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj" on node 1 (default targets).
Project "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj" (1) is building "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\ZERO_CHECK.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
  Creating directory "x64\Release\ZERO_CHECK\".
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\ZERO_CHECK.vcxproj]
  Creating directory "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\".
InitializeBuildStatus:
  Creating "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Checking Build System
  CMake does not need to re-run because C:/Users/dogus/AppData/Local/Temp/pip-install-i06iyve7/lightgbm/build_cpp/CMakeFiles/generate.stamp is up-to-date.
FinalizeBuildStatus:
  Deleting file "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
  Touching "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
Done Building Project "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\ZERO_CHECK.vcxproj" (default targets).
PrepareForBuild:
  Creating directory "_lightgbm.dir\Release\".
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]
  Creating directory "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\Release\".
  Creating directory "_lightgbm.dir\Release\_lightgbm.tlog\".
InitializeBuildStatus:
  Creating "_lightgbm.dir\Release\_lightgbm.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Building Custom Rule C:/Users/dogus/AppData/Local/Temp/pip-install-i06iyve7/lightgbm/compile/CMakeLists.txt
  CMake does not need to re-run because C:/Users/dogus/AppData/Local/Temp/pip-install-i06iyve7/lightgbm/build_cpp/CMakeFiles/generate.stamp is up-to-date.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\CL.exe /c /I"C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\compute\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include" /IC:\boost\boost_1_69_0 /I"C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\include" /nologo /W4 /WX- /diagnostics:classic /MP /O2 /Ob2 /Oi /Ot /Oy /GL /D WIN32 /D _WINDOWS /D NDEBUG /D USE_SOCKET /D BOOST_ALL_NO_LIB /D USE_GPU /D "CMAKE_INTDIR=\"Release\"" /D _lightgbm_EXPORTS /D _WINDLL /D _MBCS /Gm- /EHsc /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /openmp /Fo"_lightgbm.dir\Release\\" /Fd"_lightgbm.dir\Release\vc141.pdb" /Gd /TP /errorReport:queue "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\c_api.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\lightgbm_R.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\application\application.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\boosting\boosting.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\boosting\gbdt.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\boosting\gbdt_model_text.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\boosting\gbdt_prediction.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\boosting\prediction_early_stop.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\io\bin.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\io\config.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\io\config_auto.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\io\dataset.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\io\dataset_loader.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\io\file_io.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\io\json11.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\io\metadata.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\io\parser.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\io\tree.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\metric\dcg_calculator.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\metric\metric.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\network\linker_topo.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\network\linkers_mpi.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\network\linkers_socket.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\network\network.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\objective\objective_function.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\treelearner\data_parallel_tree_learner.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\treelearner\feature_parallel_tree_learner.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\treelearner\gpu_tree_learner.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\treelearner\serial_tree_learner.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\treelearner\tree_learner.cpp" "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\src\treelearner\voting_parallel_tree_learner.cpp"
  c_api.cpp
  lightgbm_R.cpp
  application.cpp
  boosting.cpp
  gbdt.cpp
  gbdt_model_text.cpp
  gbdt_prediction.cpp
  prediction_early_stop.cpp
  bin.cpp
  config.cpp
  config_auto.cpp
  dataset.cpp
  dataset_loader.cpp
  file_io.cpp
  json11.cpp
  metadata.cpp
  parser.cpp
  tree.cpp
  dcg_calculator.cpp
  metric.cpp
  linker_topo.cpp
  linkers_mpi.cpp
  linkers_socket.cpp
  network.cpp
  objective_function.cpp
  data_parallel_tree_learner.cpp
  feature_parallel_tree_learner.cpp
  gpu_tree_learner.cpp
  serial_tree_learner.cpp
  tree_learner.cpp
  voting_parallel_tree_learner.cpp
Link:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\Release\lib_lightgbm.dll" /INCREMENTAL:NO /NOLOGO "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\lib\x64\OpenCL.lib" "C:\boost\boost-build\lib\libboost_filesystem.a" "C:\boost\boost-build\lib\libboost_system.a" kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:"C:/Users/dogus/AppData/Local/Temp/pip-install-i06iyve7/lightgbm/compile/Release/lib_lightgbm.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/dogus/AppData/Local/Temp/pip-install-i06iyve7/lightgbm/compile/Release/lib_lightgbm.lib" /MACHINE:X64  /machine:x64 /DLL _lightgbm.dir\Release\c_api.obj
  _lightgbm.dir\Release\lightgbm_R.obj
  _lightgbm.dir\Release\application.obj
  _lightgbm.dir\Release\boosting.obj
  _lightgbm.dir\Release\gbdt.obj
  _lightgbm.dir\Release\gbdt_model_text.obj
  _lightgbm.dir\Release\gbdt_prediction.obj
  _lightgbm.dir\Release\prediction_early_stop.obj
  _lightgbm.dir\Release\bin.obj
  _lightgbm.dir\Release\config.obj
  _lightgbm.dir\Release\config_auto.obj
  _lightgbm.dir\Release\dataset.obj
  _lightgbm.dir\Release\dataset_loader.obj
  _lightgbm.dir\Release\file_io.obj
  _lightgbm.dir\Release\json11.obj
  _lightgbm.dir\Release\metadata.obj
  _lightgbm.dir\Release\parser.obj
  _lightgbm.dir\Release\tree.obj
  _lightgbm.dir\Release\dcg_calculator.obj
  _lightgbm.dir\Release\metric.obj
  _lightgbm.dir\Release\linker_topo.obj
  _lightgbm.dir\Release\linkers_mpi.obj
  _lightgbm.dir\Release\linkers_socket.obj
  _lightgbm.dir\Release\network.obj
  _lightgbm.dir\Release\objective_function.obj
  _lightgbm.dir\Release\data_parallel_tree_learner.obj
  _lightgbm.dir\Release\feature_parallel_tree_learner.obj
  _lightgbm.dir\Release\gpu_tree_learner.obj
  _lightgbm.dir\Release\serial_tree_learner.obj
  _lightgbm.dir\Release\tree_learner.obj
  _lightgbm.dir\Release\voting_parallel_tree_learner.obj
  c_api.obj : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
     Creating library C:/Users/dogus/AppData/Local/Temp/pip-install-i06iyve7/lightgbm/compile/Release/lib_lightgbm.lib and object C:/Users/dogus/AppData/Local/Temp/pip-install-i06iyve7/lightgbm/compile/Release/lib_lightgbm.exp
gpu_tree_learner.obj : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem::path_traits::convert(char const *,char const *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,class std::codecvt<wchar_t,char,struct _Mbstatet> const &)" (?convert@path_traits@filesystem@boost@@YAXPEBD0AEAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEBV?$codecvt@_WDU_Mbstatet@@@5@@Z) [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]
gpu_tree_learner.obj : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem::path_traits::convert(wchar_t const *,wchar_t const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class std::codecvt<wchar_t,char,struct _Mbstatet> const &)" (?convert@path_traits@filesystem@boost@@YAXPEB_W0AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$codecvt@_WDU_Mbstatet@@@5@@Z) [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]
gpu_tree_learner.obj : error LNK2001: unresolved external symbol "class boost::filesystem::file_status __cdecl boost::filesystem::detail::status(class boost::filesystem::path const &,class boost::system::error_code *)" (?status@detail@filesystem@boost@@YA?AVfile_status@23@AEBVpath@23@PEAVerror_code@system@3@@Z) [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]
gpu_tree_learner.obj : error LNK2001: unresolved external symbol "bool __cdecl boost::filesystem::detail::create_directories(class boost::filesystem::path const &,class boost::system::error_code *)" (?create_directories@detail@filesystem@boost@@YA_NAEBVpath@23@PEAVerror_code@system@3@@Z) [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]
gpu_tree_learner.obj : error LNK2001: unresolved external symbol "public: static class std::codecvt<wchar_t,char,struct _Mbstatet> const & __cdecl boost::filesystem::path::codecvt(void)" (?codecvt@path@filesystem@boost@@SAAEBV?$codecvt@_WDU_Mbstatet@@@std@@XZ) [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]
gpu_tree_learner.obj : error LNK2001: unresolved external symbol "public: class boost::filesystem::path & __cdecl boost::filesystem::path::make_preferred(void)" (?make_preferred@path@filesystem@boost@@QEAAAEAV123@XZ) [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]
C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\Release\lib_lightgbm.dll : fatal error LNK1120: 6 unresolved externals [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]
Done Building Project "C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj" (default targets) -- FAILED.

Build FAILED.

"C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj" (default target) (1) ->
"C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\ZERO_CHECK.vcxproj" (default target) (2) ->
(PrepareForBuild target) -> 
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\ZERO_CHECK.vcxproj]


"C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj" (default target) (1) ->
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]


"C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj" (default target) (1) ->
(Link target) -> 
  gpu_tree_learner.obj : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem::path_traits::convert(char const *,char const *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,class std::codecvt<wchar_t,char,struct _Mbstatet> const &)" (?convert@path_traits@filesystem@boost@@YAXPEBD0AEAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEBV?$codecvt@_WDU_Mbstatet@@@5@@Z) [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]
  gpu_tree_learner.obj : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem::path_traits::convert(wchar_t const *,wchar_t const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class std::codecvt<wchar_t,char,struct _Mbstatet> const &)" (?convert@path_traits@filesystem@boost@@YAXPEB_W0AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$codecvt@_WDU_Mbstatet@@@5@@Z) [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]
  gpu_tree_learner.obj : error LNK2001: unresolved external symbol "class boost::filesystem::file_status __cdecl boost::filesystem::detail::status(class boost::filesystem::path const &,class boost::system::error_code *)" (?status@detail@filesystem@boost@@YA?AVfile_status@23@AEBVpath@23@PEAVerror_code@system@3@@Z) [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]
  gpu_tree_learner.obj : error LNK2001: unresolved external symbol "bool __cdecl boost::filesystem::detail::create_directories(class boost::filesystem::path const &,class boost::system::error_code *)" (?create_directories@detail@filesystem@boost@@YA_NAEBVpath@23@PEAVerror_code@system@3@@Z) [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]
  gpu_tree_learner.obj : error LNK2001: unresolved external symbol "public: static class std::codecvt<wchar_t,char,struct _Mbstatet> const & __cdecl boost::filesystem::path::codecvt(void)" (?codecvt@path@filesystem@boost@@SAAEBV?$codecvt@_WDU_Mbstatet@@@std@@XZ) [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]
  gpu_tree_learner.obj : error LNK2001: unresolved external symbol "public: class boost::filesystem::path & __cdecl boost::filesystem::path::make_preferred(void)" (?make_preferred@path@filesystem@boost@@QEAAAEAV123@XZ) [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]
  C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\compile\Release\lib_lightgbm.dll : fatal error LNK1120: 6 unresolved externals [C:\Users\dogus\AppData\Local\Temp\pip-install-i06iyve7\lightgbm\build_cpp\_lightgbm.vcxproj]

    2 Warning(s)
    7 Error(s)

Time Elapsed 00:00:15.52

Reproducible examples

Steps to reproduce

  1. pip install lightgbm --install-option=--gpu
    2.
    3.

Most helpful comment

@dgsbicak You don't need to apologize! I'm glad that your problem was solved!

Also, according to the content of log file you've provided, seems that we need to update our docs to ensure compatibility with current CMake version. Thank you!

All 7 comments

Hi @dgsbicak !

Please do not install any software from system32 folder!

In your case, I think, setting BOOST_ROOT via args instead of env variable should help:

pip install lightgbm --install-option=--gpu --install-option="--boost-root=C:/boost/boost_1_69_0"

See this warning from log:

Environment variable Boost_ROOT is set to:
C:\boost\boost_1_69_0
For compatibility, CMake is ignoring the variable.

And ping @huanzhang12 for further investigation.

Hi StrikerRUS,
Thanks for help, but it didn't work.

PS C:\Users\dogus> pip install lightgbm --install-option=--gpu --install-option="--boost-root=C:/boost/boost_1_69_0"
c:\users\dogus\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\commands\install.py:207: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
  cmdoptions.check_install_build_global(options)
Collecting lightgbm
  Using cached https://files.pythonhosted.org/packages/c9/ce/3aff55e25e282383c19c5a5fb7387fd400e64b1a1036671aefa63ceeaaf4/lightgbm-2.2.3.tar.gz
Requirement already satisfied: numpy in c:\users\dogus\appdata\local\programs\python\python36\lib\site-packages (from lightgbm) (1.16.2)
Requirement already satisfied: scipy in c:\users\dogus\appdata\local\programs\python\python36\lib\site-packages (from lightgbm) (1.1.0)
Requirement already satisfied: scikit-learn in c:\users\dogus\appdata\local\programs\python\python36\lib\site-packages (from lightgbm) (0.19.1)
Skipping bdist_wheel for lightgbm, due to binaries being disabled for it.
Installing collected packages: lightgbm
  Running setup.py install for lightgbm ... error
    Complete output from command c:\users\dogus\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\dogus\\AppData\\Local\\Temp\\pip-install-4lx0i10z\\lightgbm\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\dogus\AppData\Local\Temp\pip-record-xawpdapa\install-record.txt --single-version-externally-managed --compile --gpu --boost-root=C:/boost/boost_1_69_0:
    running install
    INFO:LightGBM:Starting to compile the library.
    INFO:LightGBM:Starting to compile with Visual Studio 15 2017 Win64.
    Traceback (most recent call last):
      File "C:\Users\dogus\AppData\Local\Temp\pip-install-4lx0i10z\lightgbm\setup.py", line 77, in silent_call
        output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
      File "c:\users\dogus\appdata\local\programs\python\python36\lib\subprocess.py", line 336, in check_output
        **kwargs).stdout
      File "c:\users\dogus\appdata\local\programs\python\python36\lib\subprocess.py", line 418, in run
        output=stdout, stderr=stderr)
    subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', '_lightgbm', '--config', 'Release']' returned non-zero exit status 1.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\dogus\AppData\Local\Temp\pip-install-4lx0i10z\lightgbm\setup.py", line 338, in <module>
        'Topic :: Scientific/Engineering :: Artificial Intelligence'])
      File "c:\users\dogus\appdata\local\programs\python\python36\lib\site-packages\setuptools\__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "c:\users\dogus\appdata\local\programs\python\python36\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\users\dogus\appdata\local\programs\python\python36\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "c:\users\dogus\appdata\local\programs\python\python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\dogus\AppData\Local\Temp\pip-install-4lx0i10z\lightgbm\setup.py", line 261, in run
        openmp_include_dir=self.openmp_include_dir, openmp_library=self.openmp_library)
      File "C:\Users\dogus\AppData\Local\Temp\pip-install-4lx0i10z\lightgbm\setup.py", line 165, in compile_cpp
        error_msg='Please install CMake first')
      File "C:\Users\dogus\AppData\Local\Temp\pip-install-4lx0i10z\lightgbm\setup.py", line 86, in silent_call
        raise Exception("\n".join((error_msg, LOG_NOTICE)))
    Exception: Please install CMake first
    The full version of error log was saved into C:\Users\dogus\LightGBM_compilation.log

    ----------------------------------------
Command "c:\users\dogus\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\dogus\\AppData\\Local\\Temp\\pip-install-4lx0i10z\\lightgbm\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\dogus\AppData\Local\Temp\pip-record-xawpdapa\install-record.txt --single-version-externally-managed --compile --gpu --boost-root=C:/boost/boost_1_69_0" failed with error code 1 in C:\Users\dogus\AppData\Local\Temp\pip-install-4lx0i10z\lightgbm\

Hello, @huanzhang12, I need your help

Previously I installed LightGBM via this guilde: https://lightgbm.readthedocs.io/en/latest/GPU-Windows.html
So, I know it works, I tested it by using the guide in the link. But somehow can't manage pip install. And I dont know how to use LightGBM other then Python.

@dgsbicak Can you please paste the content of LightGBM_compilation.txt as in your first message?

Also, try to specify BOOST_LIBRARYDIR option via args too:

pip install lightgbm --install-option=--gpu --install-option="--boost-root=C:/boost/boost_1_69_0" --install-option="--boost-librarydir=C:/boost/boost_1_69_0/lib64-msvc-14.1"

@StrikerRUS Okay,

Oh IT WORKED!, the problem was I got the boost files from here https://lightgbm.readthedocs.io/en/latest/GPU-Windows.html and I didn't have /lib64-msvc-14.1 this library in my boost file.
I just reinstalled boost_1_69_0-msvc-14.1-64.exe, which I got from here two days ago.
I re-adjusted boost paths and it worked like charm!
pip install lightgbm --install-option=--gpu --install-option="--boost-root=C:/local/boost_1_69_0" --install-option="--boost-librarydir=C:/local/boost_1_69_0/lib64-msvc-14.1"

Thank you so much!!, and i am sorry for stealing your time!

@dgsbicak You don't need to apologize! I'm glad that your problem was solved!

Also, according to the content of log file you've provided, seems that we need to update our docs to ensure compatibility with current CMake version. Thank you!

@StrikerRUS seems this issue is resolved. Could it be closed?

@jameslamb Yeah, this issue is resolved and it should be auto-closed after merging #2082. However, since @huanzhang12 keeps silence for a long time, maybe you are right and we should close this issue to keep us focused on unresolved issues.

Was this page helpful?
0 / 5 - 0 ratings