diff --git a/python-package/README.md b/python-package/README.md index 20d609864..eb0fa8cca 100644 --- a/python-package/README.md +++ b/python-package/README.md @@ -5,13 +5,14 @@ Installation We are on [PyPI](https://pypi.python.org/pypi/xgboost) now. For stable version, please install using pip: * ```pip install xgboost``` -* Note for windows users: this pip installation may not work on some windows environment. Please install from github if pip doesn't work on windows. +* Note for windows users: this pip installation may not work on some windows environment, and it may cause unexpected errors. pip installation on windows is currently disabled for further invesigation, please install from github. For up-to-date version, please install from github. * To make the python module, type ```./build.sh``` in the root directory of project * Make sure you have [setuptools](https://pypi.python.org/pypi/setuptools) * Install with `python setup.py install` from this directory. +* For windows users, please use the Visual Studio project file under [windows folder](../windows/). See also the [installation tutorial](https://www.kaggle.com/c/otto-group-product-classification-challenge/forums/t/13043/run-xgboost-from-windows-and-python) from Kaggle Otto Forum. Examples ------ diff --git a/python-package/setup.py b/python-package/setup.py index a446983be..4bc8c707f 100644 --- a/python-package/setup.py +++ b/python-package/setup.py @@ -5,12 +5,17 @@ import sys 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 os +#build on the fly if install in pip +#otherwise, use build.sh in the parent directory + +if 'pip' in __file__: + if not os.name == 'nt': #if not windows + build_sh = subprocess.Popen(['sh', 'xgboost/build-python.sh']) + build_sh.wait() + output = build_sh.communicate() + print output import xgboost @@ -23,7 +28,7 @@ LIB_PATH = xgboost.core.find_lib_path() #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', + #version='0.4a13', description=xgboost.__doc__, install_requires=[ 'numpy', diff --git a/python-package/xgboost/core.py b/python-package/xgboost/core.py index 85b6a1818..41943cd61 100644 --- a/python-package/xgboost/core.py +++ b/python-package/xgboost/core.py @@ -45,8 +45,12 @@ def find_lib_path(): if os.name == 'nt': if platform.architecture()[0] == '64bit': dll_path.append(os.path.join(curr_path, '../../windows/x64/Release/')) + #hack for pip installation when copy all parent source directory here + dll_path.append(os.path.join(curr_path, './windows/x64/Release/')) else: dll_path.append(os.path.join(curr_path, '../../windows/Release/')) + #hack for pip installation when copy all parent source directory here + dll_path.append(os.path.join(curr_path, './windows/Release/')) if os.name == 'nt': dll_path = [os.path.join(p, 'xgboost_wrapper.dll') for p in dll_path] else: