0

I downloaded xgboost by using

pip instal xgboost

Then I tried to import it using Python and got error

---------------------------------------------------------------------------
XGBoostError                              Traceback (most recent call last)
<ipython-input-5-e6b2443346ed> in <module>
----> 1 import xgboost as xgb
      2 

/Applications/anaconda3/lib/python3.8/site-packages/xgboost/__init__.py in <module>
      7 import os
      8 
----> 9 from .core import DMatrix, DeviceQuantileDMatrix, Booster
     10 from .training import train, cv
     11 from . import rabit  # noqa

/Applications/anaconda3/lib/python3.8/site-packages/xgboost/core.py in <module>
    193 
    194 # load the XGBoost library globally
--> 195 _LIB = _load_lib()
    196 
    197 

/Applications/anaconda3/lib/python3.8/site-packages/xgboost/core.py in _load_lib()
    176     if not lib_success:
    177         libname = os.path.basename(lib_paths[0])
--> 178         raise XGBoostError(
    179             'XGBoost Library ({}) could not be loaded.\n'.format(libname) +
    180             'Likely causes:\n' +

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(/Applications/anaconda3/lib/python3.8/site-packages/xgboost/lib/libxgboost.dylib, 6): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib\n  Referenced from: /Applications/anaconda3/lib/python3.8/site-packages/xgboost/lib/libxgboost.dylib\n  Reason: image not found']

Error says that I should use for MacOS

brew install libomp

(base) MacBook-Pro-3:~ GS$ brew install libomp
-bash: brew: command not found

If found similiar questions 1 and 2, however they did not help to solve the problem

What else can I use?

John Mayer
  • 103
  • 7
  • `brew` is a package installer, you can either install `brew` and then the lib, or find another way to install OpenMP library (Google for OpenMP installation on Mac) – Alexey Larionov Jul 20 '21 at 14:25

0 Answers0