Cannot install XGboost

Firstly, I run brew install libomp . It installs well.
Then, I run brew install gcc@7. It installs well.
Then, I run pip3 install xgboost or pip3 install --user xgboost. It will produce the same error message.

ERROR: Command errored out with exit status 1:
command: /Users/yao/anaconda3/bin/python -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/private/var/folders/bp/t_45f9d90yb8lz02vj2ggxt00000gn/T/pip-install-bl8x9p7p/xgboost/setup.py’"’"’; file=’"’"’/private/var/folders/bp/t_45f9d90yb8lz02vj2ggxt00000gn/T/pip-install-bl8x9p7p/xgboost/setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ egg_info --egg-base /private/var/folders/bp/t_45f9d90yb8lz02vj2ggxt00000gn/T/pip-install-bl8x9p7p/xgboost/pip-egg-info
cwd: /private/var/folders/bp/t_45f9d90yb8lz02vj2ggxt00000gn/T/pip-install-bl8x9p7p/xgboost/
Complete output (27 lines):
++ pwd
+ oldpath=/private/var/folders/bp/t_45f9d90yb8lz02vj2ggxt00000gn/T/pip-install-bl8x9p7p/xgboost
+ cd ./xgboost/
+ mkdir -p build
+ cd build
+ cmake …
./xgboost/build-python.sh: line 21: cmake: command not found
+ echo -----------------------------
-----------------------------
+ echo ‘Building multi-thread xgboost failed’
Building multi-thread xgboost failed
+ echo ‘Start to build single-thread xgboost’
Start to build single-thread xgboost
+ cmake … -DUSE_OPENMP=0
./xgboost/build-python.sh: line 27: cmake: command not found
Traceback (most recent call last):
File “”, line 1, in
File “/private/var/folders/bp/t_45f9d90yb8lz02vj2ggxt00000gn/T/pip-install-bl8x9p7p/xgboost/setup.py”, line 42, in
LIB_PATH = libpath’find_lib_path’
File “/private/var/folders/bp/t_45f9d90yb8lz02vj2ggxt00000gn/T/pip-install-bl8x9p7p/xgboost/xgboost/libpath.py”, line 50, in find_lib_path
‘List of candidates:\n’ + (’\n’.join(dll_path)))
XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?
List of candidates:
/private/var/folders/bp/t_45f9d90yb8lz02vj2ggxt00000gn/T/pip-install-bl8x9p7p/xgboost/xgboost/libxgboost.dylib
/private/var/folders/bp/t_45f9d90yb8lz02vj2ggxt00000gn/T/pip-install-bl8x9p7p/xgboost/xgboost/…/…/lib/libxgboost.dylib
/private/var/folders/bp/t_45f9d90yb8lz02vj2ggxt00000gn/T/pip-install-bl8x9p7p/xgboost/xgboost/./lib/libxgboost.dylib
/Users/yao/anaconda3/xgboost/libxgboost.dylib
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Please install CMake.

Hi I have installed CMake but still got the same error

I am getting the same error, pls @hcho3 can you help

1 Like

I have tried as well. Same error. I tried installing the xg boost package directly from Anaconda’s webiste but it doesn’t help either? https://anaconda.org/conda-forge/xgboost/files?version=0.7.post3

You should be able to run pip install xgboost, per the guideline in https://xgboost.readthedocs.io/en/latest/build.html.