diff --git a/Makefile b/Makefile index 9474ce31c..54aeea9a6 100644 --- a/Makefile +++ b/Makefile @@ -180,8 +180,10 @@ pythonpack: #make clean cd subtree/rabit;make clean;cd .. rm -rf xgboost-deploy xgboost*.tar.gz + #pip install pypandoc and also brew/apt-get install pandoc + python python-package/conv_rst.py cp -r python-package xgboost-deploy - cp *.md xgboost-deploy/ + #cp *.md xgboost-deploy/ cp LICENSE xgboost-deploy/ cp Makefile xgboost-deploy/xgboost cp -r wrapper xgboost-deploy/xgboost @@ -189,6 +191,7 @@ pythonpack: cp -r multi-node xgboost-deploy/xgboost cp -r windows xgboost-deploy/xgboost cp -r src xgboost-deploy/xgboost + cp python-package/setup_pip.py xgboost-deploy/setup.py #make python pythonbuild: diff --git a/python-package/MANIFEST.in b/python-package/MANIFEST.in index 01ea397c1..83596d826 100644 --- a/python-package/MANIFEST.in +++ b/python-package/MANIFEST.in @@ -1,4 +1,4 @@ -include *.sh *.md +include *.sh *.md *.rst recursive-include xgboost * recursive-include xgboost/wrapper * recursive-include xgboost/windows * diff --git a/python-package/README.rst b/python-package/README.rst new file mode 100644 index 000000000..3379e0ece --- /dev/null +++ b/python-package/README.rst @@ -0,0 +1,56 @@ +XGBoost Python Package +====================== + +|PyPI version| |PyPI downloads| + +Installation +------------ + +We are on `PyPI `__ 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, 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 `__ +- 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 `__ + from Kaggle Otto Forum. + +Examples +-------- + +- Refer also to the walk through example in `demo + folder <../demo/guide-python>`__ +- See also the `example scripts <../demo/kaggle-higgs>`__ for Kaggle + Higgs Challenge, including `speedtest + script <../demo/kaggle-higgs/speedtest.py>`__ on this dataset. + +Note +---- + +- If you want to build xgboost on Mac OS X with multiprocessing support + where clang in XCode by default doesn't support, please install gcc + 4.9 or higher using `homebrew `__ + ``brew tap homebrew/versions; brew install gcc49`` +- If you want to run XGBoost process in parallel using the fork backend + for joblib/multiprocessing, you must build XGBoost without support + for OpenMP by ``make no_omp=1``. Otherwise, use the forkserver (in + Python 3.4) or spawn backend. See the + `sklearn\_parallel.py <../demo/guide-python/sklearn_parallel.py>`__ + demo. + +.. |PyPI version| image:: https://badge.fury.io/py/xgboost.svg + :target: http://badge.fury.io/py/xgboost +.. |PyPI downloads| image:: https://img.shields.io/pypi/dm/xgboost.svg + :target: https://pypi.python.org/pypi/xgboost/ diff --git a/python-package/build_trouble_shooting.md b/python-package/build_trouble_shooting.md index 504575514..c62846a83 100644 --- a/python-package/build_trouble_shooting.md +++ b/python-package/build_trouble_shooting.md @@ -20,6 +20,7 @@ Linux platform (also Mac OS X in general) * installed C++ compilers, for example `g++` and `gcc` (Linux) or `clang LLVM` (Mac OS X). Recommended compilers are `g++-5` or newer (Linux and Mac), or `clang` comes with Xcode in Mac OS X. For installting compilers, please refer to your system package management commands, e.g. `apt-get` `yum` or `brew`(Mac). * compilers in your `$PATH`. Try typing `gcc` and see if your have it in your path. +* Do you use other shells than `bash` and install from `pip`? In some old version of pip installation, the shell script used `pushd` for changing directory and triggering the build process, which may failed some shells without `pushd` command. Please update to the latest version by removing the old installation and redo `pip install xgboost` **Trouble 1**: I see the same error message in **Trouble 0** when install from `pip install xgboost`. diff --git a/python-package/conv_rst.py b/python-package/conv_rst.py new file mode 100644 index 000000000..9e2a0edc6 --- /dev/null +++ b/python-package/conv_rst.py @@ -0,0 +1,6 @@ +# pylint: disable=invalid-name, exec-used +"""Convert README.md to README.rst for PyPI""" +from pypandoc import convert +read_md = convert('python-package/README.md', 'rst') +with open('python-package/README.rst', 'w') as rst_file: + rst_file.write(read_md) diff --git a/python-package/setup.cfg b/python-package/setup.cfg index b88034e41..5aef279b9 100644 --- a/python-package/setup.cfg +++ b/python-package/setup.cfg @@ -1,2 +1,2 @@ [metadata] -description-file = README.md +description-file = README.rst diff --git a/python-package/setup_pip.py b/python-package/setup_pip.py index 83d907c25..b9b58ac8d 100644 --- a/python-package/setup_pip.py +++ b/python-package/setup_pip.py @@ -34,8 +34,8 @@ LIB_PATH = libpath['find_lib_path']() #and be sure to test it firstly using "python setup.py register sdist upload -r pypitest" setup(name='xgboost', #version=open(os.path.join(CURRENT_DIR, 'xgboost/VERSION')).read().strip(), - version='0.4a24', - description=open(os.path.join(CURRENT_DIR, 'README.md')).read(), + version='0.4a28', + description=open(os.path.join(CURRENT_DIR, 'README.rst')).read(), install_requires=[ 'numpy', 'scipy', diff --git a/python-package/xgboost/build-python.sh b/python-package/xgboost/build-python.sh index ecc336e61..4bec205a2 100755 --- a/python-package/xgboost/build-python.sh +++ b/python-package/xgboost/build-python.sh @@ -10,7 +10,9 @@ # conflict with build.sh which is for everything. -pushd xgboost +#pushd xgboost +oldpath=`pwd` +cd ./xgboost/ #remove the pre-compiled .so and trigger the system's on-the-fly compiling make clean if make python; then @@ -25,4 +27,4 @@ else echo "If you want multi-threaded version" echo "See additional instructions in doc/build.md" fi -popd +cd $oldpath