Make pip install xgboost*.tar.gz work by fixing build-python.sh (#5241)
* Make pip install xgboost*.tar.gz work by fixing build-python.sh * Simplify install doc * Add test * Install Miniconda for Linux target too * Build XGBoost only once in sdist * Try importing xgboost after installation * Don't set PYTHONPATH env var for sdist test
This commit is contained in:
committed by
GitHub
parent
cb3ed404cf
commit
4240daed4e
@@ -12,47 +12,22 @@
|
||||
set -e
|
||||
set -x
|
||||
|
||||
#pushd xgboost
|
||||
oldpath=`pwd`
|
||||
cd ./xgboost/
|
||||
|
||||
GCC_PATH=""
|
||||
if echo "${OSTYPE}" | grep -q "darwin"; then
|
||||
# Use OpenMP-capable compiler if possible
|
||||
if [ "v"`sw_vers -buildVersion` -ge "v17G65" ]; then
|
||||
if which g++-9; then
|
||||
GCC_PATH="CC=gcc-9 CXX=g++-9"
|
||||
else
|
||||
echo "For MacOS version higher than High Sierra, please install gcc@9 first."
|
||||
fi
|
||||
elif which g++-5; then
|
||||
GCC_PATH="CC=gcc-5 CXX=g++-5"
|
||||
elif which g++-7; then
|
||||
GCC_PATH="CC=gcc-7 CXX=g++-7"
|
||||
elif which g++-8; then
|
||||
GCC_PATH="CC=gcc-8 CXX=g++-8"
|
||||
elif which clang++; then
|
||||
GCC_PATH="CC=clang CXX=clang++"
|
||||
fi
|
||||
fi
|
||||
|
||||
#remove the pre-compiled .so and trigger the system's on-the-fly compiling
|
||||
mkdir -p build
|
||||
cd build
|
||||
if [ -f * ]; then
|
||||
rm -r *
|
||||
fi
|
||||
if eval $GCC_PATH" cmake .." && eval $GCC_PATH" make -j4"; then
|
||||
echo "Successfully build multi-thread xgboost"
|
||||
if cmake .. && make -j4; then
|
||||
echo "Successfully built multi-thread xgboost"
|
||||
else
|
||||
echo "-----------------------------"
|
||||
echo "Building multi-thread xgboost failed"
|
||||
echo "Start to build single-thread xgboost"
|
||||
eval $GCC_PATH" cmake .. -DUSE_OPENMP=0"
|
||||
eval $GCC_PATH" make -j4"
|
||||
echo "Successfully build single-thread xgboost"
|
||||
echo "If you want multi-threaded version"
|
||||
echo "See additional instructions in doc/build.md"
|
||||
cmake .. -DUSE_OPENMP=0
|
||||
make -j4
|
||||
echo "Successfully built single-thread xgboost; training speed may be suboptimal."
|
||||
echo "To use all CPU cores for training jobs, install libomp package from Homebrew and re-install XGBoost"
|
||||
fi
|
||||
cd $oldpath
|
||||
|
||||
|
||||
Reference in New Issue
Block a user