ERROR: Command "python setup.py 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 setup.py 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/Xcode-beta.app/Contents/Developer") does not exist_
_ Use sudo xcode-select --switch path/to/Xcode.app 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/setup.py", line 42, in
_ LIB_PATH = libpath’find_lib_path’_
_ File "/private/var/folders/d4/kj5nnts6t5_zb28wm584w_c0000gn/T/pip-install-yk5_2mt4/xgboost/xgboost/libpath.py", 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 build.sh 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 setup.py 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/Xcode.app command line code, I get the following error.

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

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
Etienne

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