README.rst 2.5 KB
Newer Older
Guolin Ke's avatar
Guolin Ke committed
1
2
3
LightGBM Python Package
=======================

Guolin Ke's avatar
Guolin Ke committed
4
5
6
|PyPI version|


Guolin Ke's avatar
Guolin Ke committed
7
8
9
Installation
------------

Guolin Ke's avatar
Guolin Ke committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Preparation
'''''''''''

You need to install `cmake <https://cmake.org/>`_ and `setuptools <https://pypi.python.org/pypi/setuptools>`_ first. 

For Windows users, Visual Studio (or `MS Build <https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017>`_) is needed. You also can use MinGW instead if installing from GitHub.

For Mac OS X users, gcc with OpenMP support must be installed first. Refer to `wiki <https://github.com/Microsoft/LightGBM/wiki/Installation-Guide#osx>`_ for installing gcc with OpenMP support.

Note: 32-bit python is not supported. Please install 64-bit version.

Install from pip
''''''''''''''''

``pip install lightgbm``

For the MinGW build in Windows and GPU support, please install the latest version from GitHub.
Guolin Ke's avatar
Guolin Ke committed
27

Guolin Ke's avatar
Guolin Ke committed
28
29
Install from GitHub
'''''''''''''''''''
Guolin Ke's avatar
Guolin Ke committed
30

Guolin Ke's avatar
Guolin Ke committed
31
32
33
34
35
36
37
38
39
40
41
.. code:: sh

    git clone --recursive https://github.com/Microsoft/LightGBM
    cd LightGBM/python-package
    python setup.py install

You may need to use ``sudo`` (or administrator rights in Windows) to perform ``python setup.py install``.

Use ``python setup.py install --mingw`` to use MinGW in Windows.

Use ``python setup.py install --gpu`` to enable GPU support. You will need to install Boost and OpenCL first: details for installation can be found in `gpu-support <https://github.com/Microsoft/LightGBM/wiki/Installation-Guide#with-gpu-support>`_.
Guolin Ke's avatar
Guolin Ke committed
42
43
44
45

Examples
--------

Guolin Ke's avatar
Guolin Ke committed
46
Refer to the walk through examples in `python-guide folder <https://github.com/Microsoft/LightGBM/tree/master/examples/python-guide>`_
wxchan's avatar
wxchan committed
47
48
49


Troubleshooting
Guolin Ke's avatar
Guolin Ke committed
50
---------------
wxchan's avatar
wxchan committed
51

Guolin Ke's avatar
Guolin Ke committed
52
Refer to `FAQ <https://github.com/Microsoft/LightGBM/tree/master/docs/FAQ.md>`_ 
wxchan's avatar
wxchan committed
53
54

Developments
Guolin Ke's avatar
Guolin Ke committed
55
------------
wxchan's avatar
wxchan committed
56

Guolin Ke's avatar
Guolin Ke committed
57
The code style of python package follows `pep8 <https://www.python.org/dev/peps/pep-0008/>`_. If you would like to make a contribution and not familiar with pep-8, please check the pep8 style guide first. Otherwise, you won't pass the check. You should be careful about:
wxchan's avatar
wxchan committed
58

59
- E1 Indentation (check pep8 link above)
wxchan's avatar
wxchan committed
60
61
62
63
64
65
66
67
- E202 whitespace before and after brackets
- E225 missing whitespace around operator
- E226 missing whitespace around arithmetic operator
- E261 at least two spaces before inline comment
- E301 expected 1 blank line in front of and at the end of a method
- E302 expected 2 blank lines in front of and at the end of a function or a class

You can ignore E501 (line too long).
Guolin Ke's avatar
Guolin Ke committed
68
69
70
71


.. |PyPI version| image:: https://badge.fury.io/py/lightgbm.svg
    :target: https://badge.fury.io/py/lightgbm