現象
anacondaなどを使って
import xgboost as xgb
をしようとすると以下のようなエラーが出る場合がある
opt/anaconda3/envs/locale1/lib/python3.7/site-packages/xgboost/core.py in _load_lib()
162 '`brew install libomp` to install OpenMP runtime.\n' +
163 ' * You are running 32-bit Python on a 64-bit OS\n' +
--> 164 'Error message(s): {}\n'.format(os_error_list))
165 lib.XGBGetLastError.restype = ctypes.c_char_p
166 lib.callback = _get_log_callback_func()
XGBoostError: XGBoost Library (libxgboost.dylib) could not be loaded.
Likely causes:
* OpenMP runtime is not installed (vcomp140.dll or libgomp-1.dll for Windows, libomp.dylib for Mac OSX, libgomp.so for Linux and other UNIX-like OSes). Mac OSX users: Run `brew install libomp` to install OpenMP runtime.
* You are running 32-bit Python on a 64-bit OS
Error message(s): ~~~
対処方法
以下を実行してあげれば動きました
brew install libomp