4.4 KiB
XGBoost Python Package Troubleshooting
Windows platform
The current best solution for installing xgboost on windows machine is building from github. Please go to windows, build with the Visual Studio project file, and install. Additional detailed instruction can be found at this installation tutorial from Kaggle Otto Forum.
pip install xgboost is not tested nor supported in windows platform for now.
Linux platform (also Mac OS X in general)
Trouble 0: I see error messages like this when install from github using python setup.py install.
XGBoostLibraryNotFound: Cannot find XGBoost Libarary in the candidate path, did you install compilers and run build.sh in root path?
List of candidates:
/home/dmlc/anaconda/lib/python2.7/site-packages/xgboost-0.4-py2.7.egg/xgboost/libxgboostwrapper.so
/home/dmlc/anaconda/lib/python2.7/site-packages/xgboost-0.4-py2.7.egg/xgboost/../../wrapper/libxgboostwrapper.so
/home/dmlc/anaconda/lib/python2.7/site-packages/xgboost-0.4-py2.7.egg/xgboost/./wrapper/libxgboostwrapper.so
Solution 0: Please check if you have:
-
installed the latest C++ compilers and
make, for exampleg++andgcc(Linux) orclang LLVM(Mac OS X). Recommended compilers areg++-5or newer (Linux and Mac), orclangcomes with Xcode in Mac OS X. For installting compilers, please refer to your system package management commands, e.g.apt-getyumorbrew(Mac). -
compilers in your
$PATH. Try typinggccand see if your have it in your path. -
Do you use other shells than
bashand install frompip? In some old version of pip installation, the shell script usedpushdfor changing directory and triggering the build process, which may failed some shells withoutpushdcommand. Please update to the latest version by removing the old installation and redopip install xgboost -
Some outdated
makemay not recognize the recent changes in theMakefileand gives this error, please update to the latestmake:/usr/lib/ruby/gems/1.8/gems/make-0.3.1/bin/make:4: undefined local variable or method 'make' for main:Object (NameError)
Trouble 1: I see the same error message in Trouble 0 when install from pip install xgboost.
Solution 1: the problem is the same as in Trouble 0, please see Solution 0.
Trouble 2: I see this error message when pip install xgboost. It says I have libxgboostwrapper.so but it is not valid.
OSError: /home/dmlc/anaconda/lib/python2.7/site-packages/xgboost/./wrapper/libxgboostwrapper.so: invalid ELF header
Solution 2: Solution is as in 0 and 1 by installing the latest g++ compiler and the latest make. The reason for this rare error is that, pip ships with a pre-compiled libxgboostwrapper.so with Mac for placeholder for allowing setup.py to find the right lib path. If a system doesn't compile, it may refer to this placeholder lib and fail. This placeholder libxgboostwrapper.so will be automatically removed and correctly generated by the compiling on-the-fly for the system.
Trouble 3: My system's pip says it can't find a valid xgboost installation release on PyPI.
Solution 3: Some linux system comes with an old pip version. Please update to the latest pip by following the official installation document at http://pip.readthedocs.org/en/stable/installing/
Trouble 4: I tried python setup.py install but it says setuptools import fail.
Solution 4: Please make sure you have setuptools before installing the python package.
Mac OS X (specific)
Most of the troubles and solutions are the same with that in the Linux platform. Mac has the following specific problems.
Trouble 0: I successfully installed xgboost using github installation/using pip install xgboost. But it runs very slow with only single thread, what is going on?
Solution 0: clang LLVM compiler on Mac OS X from Xcode doesn't support OpenMP multi-thread. An alternative choice is installing homebrew http://brew.sh/ and brew install g++-5 which provides multi-thread OpenMP support.
Trouble 1: Can I install clang-omp for supporting OpenMP without using gcc?
Solution 1: it is not support and may have linking errors.