I installed XGBoost using
conda install -c anaconda py-xgboost, it throws the following error when importing the package in Python.
import xgboost Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/mike/opt/miniconda3/lib/python3.8/site-packages/xgboost/__init__.py", line 9, in <module> from .core import DMatrix, DeviceQuantileDMatrix, Booster File "/Users/mike/opt/miniconda3/lib/python3.8/site-packages/xgboost/core.py", line 174, in <module> _LIB = _load_lib() File "/Users/mike/opt/miniconda3/lib/python3.8/site-packages/xgboost/core.py", line 157, in _load_lib raise XGBoostError( xgboost.core.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): ['dlopen(/Users/mike/opt/miniconda3/lib/python3.8/site-packages/xgboost/lib/libxgboost.dylib, 6): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib\n Referenced from: /Users/mike/opt/miniconda3/lib/python3.8/site-packages/xgboost/lib/libxgboost.dylib\n Reason: image not found']
After reading the above error, I installed libomp using
brew install libomp, and restarted the computer. Same error message after importing.
What is going on?
Thanks a lot!