Skip to main content

LightGBM Python Package

Project description

License PyPI Version

Installation

Preparation

setuptools is needed.

For Mac OS X users, gcc with OpenMP support must be installed first. Refer to wiki for installing gcc with OpenMP support.

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

Install from PyPI using pip

For Windows users, VC runtime is needed if Visual Studio (2013, 2015 or 2017) is not installed.

Install wheel via pip install wheel first. After that download the wheel file and install from it:

pip install lightgbm

Build from sources

pip install --no-binary :all: lightgbm

For Linux and Mac OS X users, installation from sources requires installed CMake.

For Mac OS X users, you need to specify compilers by runnig export CXX=g++-7 CC=gcc-7 first.

For Windows users, Visual Studio (or MS Build) is needed. If you get any errors during installation, you may need to install CMake (version 3.8 or higher).

Build GPU version
pip install lightgbm --install-option=--gpu

For Windows users, CMake (version 3.8 or higher) is strongly required in this case.

Note: Boost and OpenCL are needed: details for installation can be found in gpu-support. You need to add OpenCL_INCLUDE_DIR to the environmental variable ‘PATH’ and export BOOST_ROOT before installation.

Build with MinGW-w64 on Windows
pip install lightgbm --install-option=--mingw

Note: CMake and MinGW-w64 should be installed first.

Install from GitHub

For Linux and Mac OS X users, installation from GitHub requires installed CMake.

For Windows users, Visual Studio (or MS Build) is needed. If you get any errors during installation and there is the warning WARNING:LightGBM:Compilation with MSBuild from existing solution file failed. in the log, you should install CMake (version 3.8 or higher).

git clone --recursive https://github.com/Microsoft/LightGBM.git
cd LightGBM/python-package
# export CXX=g++-7 CC=gcc-7  # for Mac OS X users only
python setup.py install

Note: sudo (or administrator rights in Windows) may be needed to perform the command.

Run python setup.py install --mingw if you want to use MinGW-w64 on Windows instead of Visual Studio. CMake and MinGW-w64 should be installed first.

Run python setup.py install --gpu to enable GPU support. For Windows users, CMake (version 3.8 or higher) is strongly required in this case. Boost and OpenCL are needed: details for installation can be found in gpu-support.

If you get any errors during installation or due to any other reason, you may want to build dynamic library from sources by any method you prefer (see Installation-Guide) and then run python setup.py install --precompile.

Examples

Refer to the walk through examples in python-guide folder.

Troubleshooting

Refer to FAQ.

Developments

The code style of python package follows pep8. If you would like to make a contribution and not familiar with pep-8, please check the pep8 style guide first. Otherwise, the check won’t pass. You should be careful about:

  • E1 Indentation (check pep8 link above)

  • 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

E501 can be ignored (line too long).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lightgbm-2.0.7.tar.gz (590.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

lightgbm-2.0.7-py2.py3-none-win_amd64.whl (388.8 kB view details)

Uploaded Python 2Python 3Windows x86-64

lightgbm-2.0.7-py2.py3-none-manylinux1_x86_64.whl (601.0 kB view details)

Uploaded Python 2Python 3

lightgbm-2.0.7-py2.py3-none-macosx_10_9_x86_64.macosx_10_10_x86_64.macosx_10_11_x86_64.macosx_10_12_x86_64.whl (592.0 kB view details)

Uploaded Python 2Python 3macOS 10.10+ x86-64macOS 10.11+ x86-64macOS 10.12+ x86-64macOS 10.9+ x86-64

File details

Details for the file lightgbm-2.0.7.tar.gz.

File metadata

  • Download URL: lightgbm-2.0.7.tar.gz
  • Upload date:
  • Size: 590.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for lightgbm-2.0.7.tar.gz
Algorithm Hash digest
SHA256 4c0c5e20f36908db04c46918782c7c4a8ecce721a2d8a93f55591a7252350de1
MD5 8e7188b617274da78cfc7538bd60e3b9
BLAKE2b-256 b0961556a33fae20cf7b9c7100621a89c9bc0cad47882d1b103d5bc44c64496f

See more details on using hashes here.

File details

Details for the file lightgbm-2.0.7-py2.py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for lightgbm-2.0.7-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 36cdaebc4cfa36ee4b282b6df7a6e3534a4b05bf250f545634f207d110c0e028
MD5 1e1a7dc15a9be0ca09149649b28e956b
BLAKE2b-256 c3d57f92e087e40a0089774e94b3bd0a31bea5694483bedb9a1097dd2f5719a2

See more details on using hashes here.

File details

Details for the file lightgbm-2.0.7-py2.py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for lightgbm-2.0.7-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 43111b8ca308c609c2390fce6e164c41e2df6cedca8abc3257697957fff5e346
MD5 a03f2fba4d737c1213aa2cbde8934025
BLAKE2b-256 3b8fd4ae7aa51efbc46951aa96bfeaeebdeb7e92485f1891e8f987ee0be707cb

See more details on using hashes here.

File details

Details for the file lightgbm-2.0.7-py2.py3-none-macosx_10_9_x86_64.macosx_10_10_x86_64.macosx_10_11_x86_64.macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for lightgbm-2.0.7-py2.py3-none-macosx_10_9_x86_64.macosx_10_10_x86_64.macosx_10_11_x86_64.macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b8f57b8894cba81a6faa087dda645a3b1eb1844a58d823124e5ef5495b803f6c
MD5 e79eef50d38eaef6bf33898f36402acc
BLAKE2b-256 8fd6761250ef2f7221a7ad317e18dffda690bb9111d5823626ab39869da52cc6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page