Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble installing xgboost on OSX 10.14 #4949

Closed
allisonmcampbell opened this issue Oct 15, 2019 · 12 comments
Closed

Trouble installing xgboost on OSX 10.14 #4949

allisonmcampbell opened this issue Oct 15, 2019 · 12 comments

Comments

@allisonmcampbell
Copy link

Hi there,

I feel like I've tried everything under the sun to install xgboost on my mac (mohave), but I'm still running into dead ends.

Some things I've tried:
#4477
When I run the step

$ cmake ..

I get this error:

`-- The CXX compiler identification is GNU 5.5.0
-- The C compiler identification is GNU 5.5.0
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/local/bin/g++-5
-- Check for working CXX compiler: /usr/local/bin/g++-5 -- broken
CMake Error at /usr/local/Cellar/cmake/3.15.4/share/cmake/Modules/CMakeTestCXXCompiler.cmake:53 (message):
The C++ compiler

"/usr/local/bin/g++-5"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /Users/camp426/xgboost/build/CMakeFiles/CMakeTmp

Run Build Command(s):/Users/camp426/anaconda3/bin/make cmTC_55296/fast && /Users/camp426/anaconda3/bin/make -f CMakeFiles/cmTC_55296.dir/build.make CMakeFiles/cmTC_55296.dir/build
make[1]: Entering directory '/Users/camp426/xgboost/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_55296.dir/testCXXCompiler.cxx.o
/usr/local/bin/g++-5    -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.14   -o CMakeFiles/cmTC_55296.dir/testCXXCompiler.cxx.o -c /Users/camp426/xgboost/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
g++-5: error: unrecognized command line option '-stdlib=libc++'
make[1]: *** [CMakeFiles/cmTC_55296.dir/build.make:66: CMakeFiles/cmTC_55296.dir/testCXXCompiler.cxx.o] Error 1
make[1]: Leaving directory '/Users/camp426/xgboost/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_55296/fast] Error 2

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)

-- Configuring incomplete, errors occurred!
See also "/Users/camp426/xgboost/build/CMakeFiles/CMakeOutput.log".
See also "/Users/camp426/xgboost/build/CMakeFiles/CMakeError.log".`

I have homebrew, I've updated homebrew, I've tried installing xgboost (using both pip and pip3) with gcc5, gcc8, and gcc9.2 (newest version), none work. I get the same error:

Command "python setup.py egg_info" failed with error code 1

Which I see by the multiple issues that I found googling that this is a known issue.

I'm in dead-end land. Help please.

@gomlfx

This comment has been minimized.

@trivialfis
Copy link
Member

I'm not an OSX user. @hcho3 could you help taking a look when you are back?

Community help is very much wanted. We currently run osx test on Travis but it doesn't seem the tests can cover all cases.

@hcho3
Copy link
Collaborator

hcho3 commented Oct 15, 2019

@bearcub For now, you should try brew install xgboost. This is by far the easiest method to install XGBoost (to my knowledge). The disadvantage is that multithreading will not be supported in this method, so training will be slow. As a fellow Mac user (Macbook Pro), I have interest in making XGBoost easy to install on Macs. See #4477.

@gomlfx I'm hiding your comment because it's a shallow dismissal of a legitimate problem. Please do not comment like that here. We should aim to respect fellow users.

@hcho3
Copy link
Collaborator

hcho3 commented Oct 15, 2019

@bearcub Also, make sure that you installed the Command Line Tools (CLT) for Xcode.

@allisonmcampbell
Copy link
Author

allisonmcampbell commented Oct 15, 2019

@hcho3 brew install xgboost has no errors. It just looks like it downloaded it, though?

(base) WE37632:~ camp426$ brew install xgboost ==> Downloading https://homebrew.bintray.com/bottles/xgboost-0.90.mojave.bottle.ta ==> Downloading from https://akamai.bintray.com/28/280fe55391f3b02fd7424afbcda34bb ######################################################################## 100.0% ==> Pouring xgboost-0.90.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/xgboost/0.90: 121 files, 6.9MB

how do I test if it's working? import xgboost in python doesn't work yet.

@hcho3
Copy link
Collaborator

hcho3 commented Oct 15, 2019

EDIT. This comment is now outdated. See #4949 (comment) instead.

@bearcub It looks like brew install xgboost only installs libxgboost.dylib. The Python library will need to be installed separately:

git clone --recursive https://github.com/dmlc/xgboost -b release_0.90
cd xgboost
mkdir lib
cd lib
ln -s /usr/local/Cellar/xgboost/0.90/lib/libxgboost.dylib ./libxgboost.dylib
cd ../python-package
python3 setup.py install

After these commands, you should be able to run import xgboost.

Note to myself: submit a PR to Homebrew to install the Python package automatically.

@allisonmcampbell
Copy link
Author

derp. it werks now.

Thank you @hcho3 !!!!!

@hcho3
Copy link
Collaborator

hcho3 commented Oct 15, 2019

@bearcub No problem. Note that your XGBoost installation will only use a single CPU core (no multithreading) because issues described in #4477. If you need to use multiple CPU cores (for faster training), consider using Conda.

@connect2robiul
Copy link

This solution is not always working. In my case, I just download user argument of Xcode. I think this was happening because a new version of Xcode was downloaded and the new agreement was not accepted. Right now it's working properly.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 31, 2020
@hcho3
Copy link
Collaborator

hcho3 commented May 24, 2020

Now the latest XGBoost release (version 1.1.0) comes with a pre-built Python wheel for Mac OSX. Simply run

pip install xgboost==1.1.0

and it will install quickly. No need to worry about build failing, because we already did the build for you.

@dmlc dmlc unlocked this conversation May 24, 2020
@avriiil
Copy link

avriiil commented Jul 5, 2022

I seem to be running into this old issue. When calling pip install xgboost the build is failing with:

...
      copying xgboost/LICENSE -> build/temp.macosx-11.0-arm64-cpython-39/xgboost
      INFO:XGBoost build_ext:Building from source. /private/var/folders/ky/bqjn_gxn1xv0cn_8q5xvp3q40000gn/T/pip-install-z0v7hxaa/lib/libxgboost.dylib
      INFO:XGBoost build_ext:Run CMake command: ['cmake', 'xgboost', '-GUnix Makefiles', '-DUSE_OPENMP=1', '-DUSE_CUDA=0', '-DUSE_NCCL=0', '-DBUILD_WITH_SHARED_NCCL=0', '-DHIDE_CXX_SYMBOLS=1', '-DUSE_HDFS=0', '-DUSE_AZURE=0', '-DUSE_S3=0', '-DPLUGIN_DENSE_PARSER=0']
      error: [Errno 2] No such file or directory: 'cmake'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> xgboost

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

I have tried specifying specific versions (1.6.1, 1.6.0, 1.5.0) but those throw the same error.

Machine specs:
MacOS 11.3.1
M1 chip
pip 22.1.2

@hcho3
Copy link
Collaborator

hcho3 commented Jul 5, 2022

@rrpelgrim See coiled/benchmarks#203 (comment). Would you be able to upgrade to MacOS 12?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants