ERROR: Command "python egg_info" failed with error code 1 in /private/var/folders/d4/_kj5nnts6t5_zb28wm584w_c0000gn/T/pip-install-yk5_2mt4/xgboost/


Hi everyone

I have installed the latest version of XGBoost on MAC Mojave via brew install gcc@8 and then I also ran pip3 install xgboost but am getting the below error when running the pip3 command line code.

ERROR: Complete output from command python egg_info:
_ ERROR: ++ pwd_
_ + oldpath=/private/var/folders/d4/kj5nnts6t5_zb28wm584w_c0000gn/T/pip-install-yk5_2mt4/xgboost
_ + cd ./xgboost/_
_ + grep -q darwin_
_ + echo darwin18_
_ + LIB_XGBOOST=libxgboost.dylib_
_ + which g+±5_
_ + which g+±7_
_ /usr/local/bin/g+±7_
_ + export CC=gcc-7_
_ + CC=gcc-7_
_ + export CXX=g+±7_
_ + CXX=g+±7_
_ + make clean_
_ xcrun: error: active developer path ("/Applications/") does not exist_
_ Use sudo xcode-select --switch path/to/ to specify the Xcode that you wish to use for command line developer tools, or use xcode-select --install to install the standalone command line developer tools._
_ See man xcode-select for more details._
_ Traceback (most recent call last):_
_ File “”, line 1, in _
_ File "/private/var/folders/d4/kj5nnts6t5_zb28wm584w_c0000gn/T/pip-install-yk5_2mt4/xgboost/", line 42, in
_ LIB_PATH = libpath’find_lib_path’_
_ File "/private/var/folders/d4/kj5nnts6t5_zb28wm584w_c0000gn/T/pip-install-yk5_2mt4/xgboost/xgboost/", line 48, 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 in root path?_
_ List of candidates:_
_ /private/var/folders/d4/kj5nnts6t5_zb28wm584w_c0000gn/T/pip-install-yk5_2mt4/xgboost/xgboost/libxgboost.dylib
_ /private/var/folders/d4/kj5nnts6t5_zb28wm584w_c0000gn/T/pip-install-yk5_2mt4/xgboost/xgboost/…/…/lib/libxgboost.dylib
_ /private/var/folders/d4/kj5nnts6t5_zb28wm584w_c0000gn/T/pip-install-yk5_2mt4/xgboost/xgboost/./lib/libxgboost.dylib
_ /anaconda3/xgboost/libxgboost.dylib_
_ ----------------------------------------_
_ERROR: Command “python egg_info” failed with error code 1 in /private/var/folders/d4/kj5nnts6t5_zb28wm584w_c0000gn/T/pip-install-yk5_2mt4/xgboost/

Further to the above, when I run the sudo xcode-select --switch path/to/ command line code, I get the following error.

xcode-select: error: invalid developer directory ‘path/to/’

I have also tried to clone xgboost from the github link but haven’t had any success with it.

Any help will be appreciated.
Thanks and regards


Try setting environment variable CXX=g++-8. Alternatively, you can install gcc@7