Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to install lightgbm with pip in macos 12.3.1 (chip M1) #5269

Closed
nibu147 opened this issue Jun 6, 2022 · 5 comments
Closed

unable to install lightgbm with pip in macos 12.3.1 (chip M1) #5269

nibu147 opened this issue Jun 6, 2022 · 5 comments
Labels

Comments

@nibu147
Copy link

nibu147 commented Jun 6, 2022

Description

hello, I'm not able to install ligthtgbm with pip on my macos 12.3.1 (chip Apple M1 max).

Reproducible example

I run pip install lightgbm==3.3.2 an I get the following log error:

-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -Xclang -fopenmp (found version "5.0") 
-- Found OpenMP_CXX: -Xclang -fopenmp (found version "5.0") 
-- Found OpenMP: TRUE (found version "5.0")  
-- Performing Test MM_PREFETCH
-- Performing Test MM_PREFETCH - Failed
-- Performing Test MM_MALLOC
-- Performing Test MM_MALLOC - Success
-- Using _mm_malloc
-- Configuring done
-- Generating done
-- Build files have been written to: /private/var/folders/rf/zkkgwm8j71v04g92js8r22d00000gn/T/pip-install-9guwma0q/lightgbm_da289ae018df4168905b9697b15b632c/build_cpp
[  5%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/boosting.cpp.o
[  8%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/gbdt_prediction.cpp.o
[ 11%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/gbdt_model_text.cpp.o
[ 11%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/gbdt.cpp.o
[ 14%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/prediction_early_stop.cpp.o
[ 17%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/bin.cpp.o
[ 20%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/config.cpp.o
[ 23%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/config_auto.cpp.o
[ 26%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/dataset.cpp.o
/private/var/folders/rf/zkkgwm8j71v04g92js8r22d00000gn/T/pip-install-9guwma0q/lightgbm_da289ae018df4168905b9697b15b632c/compile/src/io/bin.cpp:164:9: warning: variable 'left_cnt_data' set but not used [-Wunused-but-set-variable]
    int left_cnt_data = 0;
        ^
/private/var/folders/rf/zkkgwm8j71v04g92js8r22d00000gn/T/pip-install-9guwma0q/lightgbm_da289ae018df4168905b9697b15b632c/compile/src/io/bin.cpp:165:9: warning: variable 'cnt_zero' set but not used [-Wunused-but-set-variable]
    int cnt_zero = 0;
        ^
/private/var/folders/rf/zkkgwm8j71v04g92js8r22d00000gn/T/pip-install-9guwma0q/lightgbm_da289ae018df4168905b9697b15b632c/compile/src/io/bin.cpp:166:9: warning: variable 'right_cnt_data' set but not used [-Wunused-but-set-variable]
    int right_cnt_data = 0;
        ^
[ 29%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/dataset_loader.cpp.o
[ 32%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/file_io.cpp.o
[ 35%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/json11.cpp.o
[ 38%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/metadata.cpp.o
[ 41%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/parser.cpp.o
3 warnings generated.
[ 44%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/train_share_states.cpp.o
[ 47%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/tree.cpp.o
[ 50%] Building CXX object CMakeFiles/_lightgbm.dir/src/metric/dcg_calculator.cpp.o
[ 52%] Building CXX object CMakeFiles/_lightgbm.dir/src/metric/metric.cpp.o
[ 55%] Building CXX object CMakeFiles/_lightgbm.dir/src/network/ifaddrs_patch.cpp.o
[ 58%] Building CXX object CMakeFiles/_lightgbm.dir/src/network/linker_topo.cpp.o
[ 61%] Building CXX object CMakeFiles/_lightgbm.dir/src/network/linkers_mpi.cpp.o
[ 64%] Building CXX object CMakeFiles/_lightgbm.dir/src/network/linkers_socket.cpp.o
[ 67%] Building CXX object CMakeFiles/_lightgbm.dir/src/network/network.cpp.o
[ 70%] Building CXX object CMakeFiles/_lightgbm.dir/src/objective/objective_function.cpp.o
[ 73%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/cuda_tree_learner.cpp.o
[ 76%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/data_parallel_tree_learner.cpp.o
[ 79%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/feature_parallel_tree_learner.cpp.o
[ 82%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/gpu_tree_learner.cpp.o
[ 85%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/linear_tree_learner.cpp.o
[ 88%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/serial_tree_learner.cpp.o
[ 91%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/tree_learner.cpp.o
[ 94%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/voting_parallel_tree_learner.cpp.o
[ 97%] Building CXX object CMakeFiles/_lightgbm.dir/src/c_api.cpp.o
[100%] Linking CXX shared library /private/var/folders/rf/zkkgwm8j71v04g92js8r22d00000gn/T/pip-install-9guwma0q/lightgbm_da289ae018df4168905b9697b15b632c/compile/lib_lightgbm.so
Undefined symbols for architecture arm64:
  "std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const", referenced from:
      LightGBM::TextReader<unsigned long>::TextReader(char const*, bool, unsigned long) in boosting.cpp.o
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      LightGBM::BinMapper::bin_info_string() const in gbdt.cpp.o
      LightGBM::GBDT::OutputMetric(int) in gbdt.cpp.o
      LightGBM::GBDT::DumpModel(int, int, int) const in gbdt_model_text.cpp.o
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > LightGBM::CommonC::Join<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, char const*) in gbdt_model_text.cpp.o
      ...
  "std::__1::basic_filebuf<char, std::__1::char_traits<char> >::open(char const*, unsigned int)", referenced from:
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
      LightGBM::DatasetLoader::GetForcedBins(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, std::__1::unordered_set<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int> > const&) in dataset_loader.cpp.o
  "std::__1::basic_filebuf<char, std::__1::char_traits<char> >::close()", referenced from:
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
  "std::__1::basic_filebuf<char, std::__1::char_traits<char> >::basic_filebuf()", referenced from:
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
      LightGBM::DatasetLoader::GetForcedBins(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, std::__1::unordered_set<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int> > const&) in dataset_loader.cpp.o
  "std::__1::basic_filebuf<char, std::__1::char_traits<char> >::~basic_filebuf()", referenced from:
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
      LightGBM::DatasetLoader::GetForcedBins(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, std::__1::unordered_set<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int> > const&) in dataset_loader.cpp.o
  "std::__1::basic_ofstream<char, std::__1::char_traits<char> >::open(char const*, unsigned int)", referenced from:
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
  "std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      LightGBM::GetLine(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, LightGBM::VirtualFileReader const*, std::__1::vector<char, std::__1::allocator<char> >*, unsigned long) in parser.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int) in parser.cpp.o
  "VTT for std::__1::basic_ifstream<char, std::__1::char_traits<char> >", referenced from:
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
      LightGBM::DatasetLoader::GetForcedBins(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, std::__1::unordered_set<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int> > const&) in dataset_loader.cpp.o
  "VTT for std::__1::basic_ofstream<char, std::__1::char_traits<char> >", referenced from:
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
  "VTT for std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from:
      LightGBM::TextReader<unsigned long>::TextReader(char const*, bool, unsigned long) in boosting.cpp.o
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream() in gbdt.cpp.o
      LightGBM::BinMapper::bin_info_string() const in gbdt.cpp.o
      LightGBM::GBDT::OutputMetric(int) in gbdt.cpp.o
      LightGBM::GBDT::DumpModel(int, int, int) const in gbdt_model_text.cpp.o
      ...
  "VTT for std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from:
      void LightGBM::Common::CheckElementsIntervalClosed<float>(float const*, float, float, int, char const*)::'lambda'(int)::operator()(int) const in metric.cpp.o
      void LightGBM::Common::CheckElementsIntervalClosed<float>(float const*, float, float, int, char const*)::'lambda'(int)::operator()(int) const in objective_function.cpp.o
      void LightGBM::Common::CheckElementsIntervalClosed<int>(int const*, int, int, int, char const*)::'lambda'(int)::operator()(int) const in c_api.cpp.o
  "vtable for std::__1::basic_ifstream<char, std::__1::char_traits<char> >", referenced from:
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
      LightGBM::DatasetLoader::GetForcedBins(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, std::__1::unordered_set<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int> > const&) in dataset_loader.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for std::__1::basic_ofstream<char, std::__1::char_traits<char> >", referenced from:
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from:
      LightGBM::TextReader<unsigned long>::TextReader(char const*, bool, unsigned long) in boosting.cpp.o
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream() in gbdt.cpp.o
      LightGBM::BinMapper::bin_info_string() const in gbdt.cpp.o
      LightGBM::GBDT::OutputMetric(int) in gbdt.cpp.o
      LightGBM::GBDT::DumpModel(int, int, int) const in gbdt_model_text.cpp.o
      ...
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from:
      LightGBM::TextReader<unsigned long>::TextReader(char const*, bool, unsigned long) in boosting.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream() in gbdt.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream() in gbdt_model_text.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream() in config.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream() in config_auto.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream() in dataset_loader.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int) in parser.cpp.o
      ...
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from:
      void LightGBM::Common::CheckElementsIntervalClosed<float>(float const*, float, float, int, char const*)::'lambda'(int)::operator()(int) const in metric.cpp.o
      void LightGBM::Common::CheckElementsIntervalClosed<float>(float const*, float, float, int, char const*)::'lambda'(int)::operator()(int) const in objective_function.cpp.o
      void LightGBM::Common::CheckElementsIntervalClosed<int>(int const*, int, int, int, char const*)::'lambda'(int)::operator()(int) const in c_api.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [/private/var/folders/rf/zkkgwm8j71v04g92js8r22d00000gn/T/pip-install-9guwma0q/lightgbm_da289ae018df4168905b9697b15b632c/compile/lib_lightgbm.so] Error 1
make[2]: *** [CMakeFiles/_lightgbm.dir/all] Error 2
make[1]: *** [CMakeFiles/_lightgbm.dir/rule] Error 2
make: *** [_lightgbm] Error 2
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -Xclang -fopenmp (found version "5.0") 
-- Found OpenMP_CXX: -Xclang -fopenmp (found version "5.0") 
-- Found OpenMP: TRUE (found version "5.0")  
-- Performing Test MM_PREFETCH
-- Performing Test MM_PREFETCH - Failed
-- Performing Test MM_MALLOC
-- Performing Test MM_MALLOC - Success
-- Using _mm_malloc
-- Configuring done
-- Generating done
-- Build files have been written to: /private/var/folders/rf/zkkgwm8j71v04g92js8r22d00000gn/T/pip-install-9guwma0q/lightgbm_da289ae018df4168905b9697b15b632c/build_cpp
[  2%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/boosting.cpp.o
[  8%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/gbdt.cpp.o
[ 11%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/gbdt_model_text.cpp.o
[ 11%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/gbdt_prediction.cpp.o
[ 14%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/prediction_early_stop.cpp.o
[ 17%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/bin.cpp.o
[ 20%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/config.cpp.o
[ 23%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/config_auto.cpp.o
[ 26%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/dataset.cpp.o
/private/var/folders/rf/zkkgwm8j71v04g92js8r22d00000gn/T/pip-install-9guwma0q/lightgbm_da289ae018df4168905b9697b15b632c/compile/src/io/bin.cpp:164:9: warning: variable 'left_cnt_data' set but not used [-Wunused-but-set-variable]
    int left_cnt_data = 0;
        ^
/private/var/folders/rf/zkkgwm8j71v04g92js8r22d00000gn/T/pip-install-9guwma0q/lightgbm_da289ae018df4168905b9697b15b632c/compile/src/io/bin.cpp:165:9: warning: variable 'cnt_zero' set but not used [-Wunused-but-set-variable]
    int cnt_zero = 0;
        ^
/private/var/folders/rf/zkkgwm8j71v04g92js8r22d00000gn/T/pip-install-9guwma0q/lightgbm_da289ae018df4168905b9697b15b632c/compile/src/io/bin.cpp:166:9: warning: variable 'right_cnt_data' set but not used [-Wunused-but-set-variable]
    int right_cnt_data = 0;
        ^
[ 29%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/dataset_loader.cpp.o
[ 32%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/file_io.cpp.o
[ 35%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/json11.cpp.o
[ 38%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/metadata.cpp.o
[ 41%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/parser.cpp.o
3 warnings generated.
[ 44%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/train_share_states.cpp.o
[ 47%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/tree.cpp.o
[ 50%] Building CXX object CMakeFiles/_lightgbm.dir/src/metric/dcg_calculator.cpp.o
[ 52%] Building CXX object CMakeFiles/_lightgbm.dir/src/metric/metric.cpp.o
[ 55%] Building CXX object CMakeFiles/_lightgbm.dir/src/network/ifaddrs_patch.cpp.o
[ 58%] Building CXX object CMakeFiles/_lightgbm.dir/src/network/linker_topo.cpp.o
[ 61%] Building CXX object CMakeFiles/_lightgbm.dir/src/network/linkers_mpi.cpp.o
[ 64%] Building CXX object CMakeFiles/_lightgbm.dir/src/network/linkers_socket.cpp.o
[ 67%] Building CXX object CMakeFiles/_lightgbm.dir/src/network/network.cpp.o
[ 70%] Building CXX object CMakeFiles/_lightgbm.dir/src/objective/objective_function.cpp.o
[ 73%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/cuda_tree_learner.cpp.o
[ 76%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/data_parallel_tree_learner.cpp.o
[ 79%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/feature_parallel_tree_learner.cpp.o
[ 82%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/gpu_tree_learner.cpp.o
[ 85%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/linear_tree_learner.cpp.o
[ 88%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/serial_tree_learner.cpp.o
[ 91%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/tree_learner.cpp.o
[ 94%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/voting_parallel_tree_learner.cpp.o
[ 97%] Building CXX object CMakeFiles/_lightgbm.dir/src/c_api.cpp.o
[100%] Linking CXX shared library /private/var/folders/rf/zkkgwm8j71v04g92js8r22d00000gn/T/pip-install-9guwma0q/lightgbm_da289ae018df4168905b9697b15b632c/compile/lib_lightgbm.so
Undefined symbols for architecture arm64:
  "std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const", referenced from:
      LightGBM::TextReader<unsigned long>::TextReader(char const*, bool, unsigned long) in boosting.cpp.o
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      LightGBM::BinMapper::bin_info_string() const in gbdt.cpp.o
      LightGBM::GBDT::OutputMetric(int) in gbdt.cpp.o
      LightGBM::GBDT::DumpModel(int, int, int) const in gbdt_model_text.cpp.o
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > LightGBM::CommonC::Join<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, char const*) in gbdt_model_text.cpp.o
      ...
  "std::__1::basic_filebuf<char, std::__1::char_traits<char> >::open(char const*, unsigned int)", referenced from:
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
      LightGBM::DatasetLoader::GetForcedBins(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, std::__1::unordered_set<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int> > const&) in dataset_loader.cpp.o
  "std::__1::basic_filebuf<char, std::__1::char_traits<char> >::close()", referenced from:
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
  "std::__1::basic_filebuf<char, std::__1::char_traits<char> >::basic_filebuf()", referenced from:
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
      LightGBM::DatasetLoader::GetForcedBins(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, std::__1::unordered_set<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int> > const&) in dataset_loader.cpp.o
  "std::__1::basic_filebuf<char, std::__1::char_traits<char> >::~basic_filebuf()", referenced from:
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
      LightGBM::DatasetLoader::GetForcedBins(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, std::__1::unordered_set<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int> > const&) in dataset_loader.cpp.o
  "std::__1::basic_ofstream<char, std::__1::char_traits<char> >::open(char const*, unsigned int)", referenced from:
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
  "std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      LightGBM::GetLine(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, LightGBM::VirtualFileReader const*, std::__1::vector<char, std::__1::allocator<char> >*, unsigned long) in parser.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int) in parser.cpp.o
  "VTT for std::__1::basic_ifstream<char, std::__1::char_traits<char> >", referenced from:
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
      LightGBM::DatasetLoader::GetForcedBins(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, std::__1::unordered_set<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int> > const&) in dataset_loader.cpp.o
  "VTT for std::__1::basic_ofstream<char, std::__1::char_traits<char> >", referenced from:
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
  "VTT for std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from:
      LightGBM::TextReader<unsigned long>::TextReader(char const*, bool, unsigned long) in boosting.cpp.o
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream() in gbdt.cpp.o
      LightGBM::BinMapper::bin_info_string() const in gbdt.cpp.o
      LightGBM::GBDT::OutputMetric(int) in gbdt.cpp.o
      LightGBM::GBDT::DumpModel(int, int, int) const in gbdt_model_text.cpp.o
      ...
  "VTT for std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from:
      void LightGBM::Common::CheckElementsIntervalClosed<float>(float const*, float, float, int, char const*)::'lambda'(int)::operator()(int) const in metric.cpp.o
      void LightGBM::Common::CheckElementsIntervalClosed<float>(float const*, float, float, int, char const*)::'lambda'(int)::operator()(int) const in objective_function.cpp.o
      void LightGBM::Common::CheckElementsIntervalClosed<int>(int const*, int, int, int, char const*)::'lambda'(int)::operator()(int) const in c_api.cpp.o
  "vtable for std::__1::basic_ifstream<char, std::__1::char_traits<char> >", referenced from:
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
      LightGBM::DatasetLoader::GetForcedBins(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, std::__1::unordered_set<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int> > const&) in dataset_loader.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for std::__1::basic_ofstream<char, std::__1::char_traits<char> >", referenced from:
      LightGBM::GBDT::SaveModelToIfElse(int, char const*) const in gbdt_model_text.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from:
      LightGBM::TextReader<unsigned long>::TextReader(char const*, bool, unsigned long) in boosting.cpp.o
      LightGBM::GBDT::Init(LightGBM::Config const*, LightGBM::Dataset const*, LightGBM::ObjectiveFunction const*, std::__1::vector<LightGBM::Metric const*, std::__1::allocator<LightGBM::Metric const*> > const&) in gbdt.cpp.o
      LightGBM::GBDT::ResetConfig(LightGBM::Config const*) in gbdt.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream() in gbdt.cpp.o
      LightGBM::BinMapper::bin_info_string() const in gbdt.cpp.o
      LightGBM::GBDT::OutputMetric(int) in gbdt.cpp.o
      LightGBM::GBDT::DumpModel(int, int, int) const in gbdt_model_text.cpp.o
      ...
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from:
      LightGBM::TextReader<unsigned long>::TextReader(char const*, bool, unsigned long) in boosting.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream() in gbdt.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream() in gbdt_model_text.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream() in config.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream() in config_auto.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream() in dataset_loader.cpp.o
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_stringstream(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int) in parser.cpp.o
      ...
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from:
      void LightGBM::Common::CheckElementsIntervalClosed<float>(float const*, float, float, int, char const*)::'lambda'(int)::operator()(int) const in metric.cpp.o
      void LightGBM::Common::CheckElementsIntervalClosed<float>(float const*, float, float, int, char const*)::'lambda'(int)::operator()(int) const in objective_function.cpp.o
      void LightGBM::Common::CheckElementsIntervalClosed<int>(int const*, int, int, int, char const*)::'lambda'(int)::operator()(int) const in c_api.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [/private/var/folders/rf/zkkgwm8j71v04g92js8r22d00000gn/T/pip-install-9guwma0q/lightgbm_da289ae018df4168905b9697b15b632c/compile/lib_lightgbm.so] Error 1
make[2]: *** [CMakeFiles/_lightgbm.dir/all] Error 2
make[1]: *** [CMakeFiles/_lightgbm.dir/rule] Error 2
make: *** [_lightgbm] Error 2

Environment info

LightGBM version or commit hash: 3.3.2

Command(s) you used to install LightGBM

pip install lightgbm==3.3.2
@nibu147 nibu147 changed the title unable to install lightgbm with pip in macos unable to install lightgbm with pip in macos 12.3.1 (chip M1) Jun 6, 2022
@StrikerRUS
Copy link
Collaborator

Just a note: maybe the reason in the AppleClang minor version. Version in this issue is 13.1.6.13160021 and successful build was performed with version 13.0.0.13000029.

@maddiedawson
Copy link

Has anyone found a workaround for this? I've tried to use a different version of gcc (export CXX=g++-12 CC=gcc-12), and also tried following the build-from-GitHub instructions but am still seeing the same issue.

@nibu147
Copy link
Author

nibu147 commented Sep 27, 2022

not on my side... that's why I turned to install lightgbm with conda :(

@IliaOzhmegov
Copy link

IliaOzhmegov commented Oct 19, 2022

I have the same issue!
I also used gcc-12 compiler, and I see the similar linking problem at the very end.

Undefined symbols for architecture arm64:
  "__ZTHN8LightGBM7Network13num_machines_E", referenced from:
      __ZN8LightGBM27ObtainAutomaticInitialScoreEPKNS_17ObjectiveFunctionEi in gbdt.cpp.o
      __ZN8LightGBM7Network11GlobalArrayIiEESt6vectorIT_SaIS3_EES3_ in dataset_loader.cpp.o
      __ZN8LightGBM13DatasetLoader23ConstructFromSampleDataEPPdPPiiPKimix in dataset_loader.cpp.o
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
make[2]: *** [/Users/iliaozhmegov/github/LightGBM/lib_lightgbm.so] Error 1
make[1]: *** [CMakeFiles/_lightgbm.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[100%] Linking CXX executable /Users/iliaozhmegov/github/LightGBM/lightgbm
Undefined symbols for architecture arm64:
  "__ZTHN8LightGBM7Network13num_machines_E", referenced from:
      __ZN8LightGBM27ObtainAutomaticInitialScoreEPKNS_17ObjectiveFunctionEi in gbdt.cpp.o
      __ZN8LightGBM7Network11GlobalArrayIiEESt6vectorIT_SaIS3_EES3_ in dataset_loader.cpp.o
      __ZN8LightGBM13DatasetLoader23ConstructFromSampleDataEPPdPPiiPKimix in dataset_loader.cpp.o
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
make[2]: *** [/Users/iliaozhmegov/github/LightGBM/lightgbm] Error 1
make[1]: *** [CMakeFiles/lightgbm.dir/all] Error 2
make: *** [all] Error 2
> make -j4
>

@jameslamb
Copy link
Collaborator

Sorry for the very long delay.

In the current state of LightGBM, it's possible to build Python package from source on the M1/M2/M3 macs. I have an M2 mac laptop now, and am able to build the latest version of LightGBM (and the Python package, lightgbm) on it.

See #6249 (comment) for exact commands to do that.

I've also found I'm able to build lightgbm==4.3.0 from sources hosted on PyPI, like this:

pip install \
    --no-binary lightgbm \
    'lightgbm>=4.3.0'

To make this easier in the future, and now that GitHub Actions provide free arm64 macOS runners, we're actively working on providing wheels for the arm64 macs on PyPI, so that in the near future you'll be able to just do pip install lightgbm with not other setup. Subscribe to #5328 to follow the progress there.

Given all that, I'm going to close this issue.

Thank you all for using LightGBM, and sorry it's taken so long to support the M1/M2/M3 macs. These reports with specific commands and logs have been very helpful in diagnosing the issues 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants