add necessary configrations for pip installation
This commit is contained in:
parent
4af680c3b6
commit
70e230815b
25
Makefile
25
Makefile
@ -1,4 +1,5 @@
|
||||
export CC = gcc
|
||||
#build on the fly
|
||||
export CXX = g++
|
||||
export MPICXX = mpicxx
|
||||
export LDFLAGS= -pthread -lm
|
||||
@ -167,6 +168,30 @@ Rcheck:
|
||||
make Rbuild
|
||||
R CMD check --as-cran xgboost*.tar.gz
|
||||
|
||||
pythonpack:
|
||||
#make clean
|
||||
cd subtree/rabit;make clean;cd ..
|
||||
rm -rf xgboost-deploy xgboost*.tar.gz
|
||||
cp -r python-package xgboost-deploy
|
||||
cp *.md xgboost-deploy/
|
||||
cp LICENSE xgboost-deploy/
|
||||
cp Makefile xgboost-deploy/xgboost
|
||||
cp -r wrapper xgboost-deploy/xgboost
|
||||
cp -r subtree xgboost-deploy/xgboost
|
||||
cp -r multi-node xgboost-deploy/xgboost
|
||||
cp -r windows xgboost-deploy/xgboost
|
||||
cp -r src xgboost-deploy/xgboost
|
||||
|
||||
#make python
|
||||
|
||||
pythonbuild:
|
||||
make pythonpack
|
||||
python setup.py install
|
||||
|
||||
pythoncheck:
|
||||
make pythonbuild
|
||||
python -c 'import xgboost;print xgboost.core.find_lib_path()'
|
||||
|
||||
# lint requires dmlc to be in current folder
|
||||
lint:
|
||||
dmlc-core/scripts/lint.py xgboost $(LINT_LANG) src wrapper R-package python-package
|
||||
|
||||
7
python-package/MANIFEST.in
Normal file
7
python-package/MANIFEST.in
Normal file
@ -0,0 +1,7 @@
|
||||
include *.sh *.md
|
||||
recursive-include xgboost *
|
||||
recursive-include xgboost/wrapper *
|
||||
recursive-include xgboost/windows *
|
||||
recursive-include xgboost/subtree *
|
||||
recursive-include xgboost/src *
|
||||
recursive-include xgboost/multi-node *
|
||||
2
python-package/setup.cfg
Normal file
2
python-package/setup.cfg
Normal file
@ -0,0 +1,2 @@
|
||||
[metadata]
|
||||
description-file = README.md
|
||||
@ -2,20 +2,41 @@
|
||||
"""Setup xgboost package."""
|
||||
from __future__ import absolute_import
|
||||
import sys
|
||||
from setuptools import setup
|
||||
from setuptools import setup,find_packages
|
||||
import subprocess
|
||||
sys.path.insert(0, '.')
|
||||
#build on the fly
|
||||
|
||||
build_sh = subprocess.Popen(['sh','xgboost/build-python.sh'])
|
||||
build_sh.wait()
|
||||
output = build_sh.communicate()
|
||||
print output
|
||||
|
||||
import xgboost
|
||||
|
||||
LIB_PATH = xgboost.core.find_lib_path()
|
||||
#print LIB_PATH
|
||||
|
||||
#to deploy to pip, please use
|
||||
#make pythonpack
|
||||
#python setup.py register sdist upload
|
||||
#and be sure to test it firstly using "python setup.py register sdist upload -r pypitest"
|
||||
setup(name='xgboost',
|
||||
version=xgboost.__version__,
|
||||
#version='0.4a12',
|
||||
description=xgboost.__doc__,
|
||||
install_requires=[
|
||||
'numpy',
|
||||
'scipy',
|
||||
],
|
||||
maintainer = 'Hongliang Liu',
|
||||
maintainer_email = 'phunter.lau@gmail.com',
|
||||
zip_safe=False,
|
||||
packages=['xgboost'],
|
||||
data_files=[('xgboost', [LIB_PATH[0]])],
|
||||
packages = find_packages(),
|
||||
#package_dir = {'':'xgboost'}, #don't need this and don't use this, give everything to MANIFEST.in
|
||||
#package_data = {'': ['*.txt','*.md','*.sh'],
|
||||
# }
|
||||
include_package_data=True, #this will use MANIFEST.in during install where we specify additional files, this is the golden line
|
||||
data_files=[('xgboost',LIB_PATH),
|
||||
],
|
||||
url='https://github.com/dmlc/xgboost')
|
||||
|
||||
26
python-package/xgboost/build-python.sh
Executable file
26
python-package/xgboost/build-python.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
# This is a simple script to make xgboost in MAC and Linux for python wrapper only
|
||||
# Basically, it first try to make with OpenMP, if fails, disable OpenMP and make it again.
|
||||
# This will automatically make xgboost for MAC users who don't have OpenMP support.
|
||||
# In most cases, type make will give what you want.
|
||||
|
||||
# See additional instruction in doc/build.md
|
||||
|
||||
# note: this script is build for python package only, and it might have some filename
|
||||
# conflict with build.sh which is for everything.
|
||||
|
||||
|
||||
pushd xgboost
|
||||
if make python; then
|
||||
echo "Successfully build multi-thread xgboost"
|
||||
else
|
||||
echo "-----------------------------"
|
||||
echo "Building multi-thread xgboost failed"
|
||||
echo "Start to build single-thread xgboost"
|
||||
make clean
|
||||
make python no_omp=1
|
||||
echo "Successfully build single-thread xgboost"
|
||||
echo "If you want multi-threaded version"
|
||||
echo "See additional instructions in doc/build.md"
|
||||
fi
|
||||
popd
|
||||
@ -39,7 +39,8 @@ def find_lib_path():
|
||||
List of all found library path to xgboost
|
||||
"""
|
||||
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
|
||||
dll_path = [curr_path, os.path.join(curr_path, '../../wrapper/')]
|
||||
#make pythonpack hack: copy this directory one level upper for setup.py
|
||||
dll_path = [curr_path, os.path.join(curr_path, '../../wrapper/'),os.path.join(curr_path, './wrapper/')]
|
||||
if os.name == 'nt':
|
||||
if platform.architecture()[0] == '64bit':
|
||||
dll_path.append(os.path.join(curr_path, '../../windows/x64/Release/'))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user