Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
d8068367
Commit
d8068367
authored
Nov 29, 2016
by
Guolin Ke
Browse files
add simple setup for pip install
parent
49d85642
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
24 deletions
+86
-24
python-package/lightgbm/__init__.py
python-package/lightgbm/__init__.py
+24
-0
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+1
-24
python-package/lightgbm/libpath.py
python-package/lightgbm/libpath.py
+27
-0
python-package/setup.py
python-package/setup.py
+34
-0
No files found.
python-package/lightgbm/__init__.py
View file @
d8068367
# coding: utf-8
"""LightGBM, Light Gradient Boosting Machine.
Contributors: https://github.com/Microsoft/LightGBM/graphs/contributors
"""
from
__future__
import
absolute_import
import
os
from
.basic
import
Predictor
,
Dataset
,
Booster
from
.engine
import
train
,
cv
try
:
from
.sklearn
import
LGBMModel
except
ImportError
:
pass
VERSION_FILE
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'VERSION'
)
with
open
(
VERSION_FILE
)
as
f
:
__version__
=
f
.
read
().
strip
()
__all__
=
[
'Dataset'
,
'Booster'
,
'train'
,
'cv'
,
'LGBMModel'
]
\ No newline at end of file
python-package/lightgbm/basic.py
View file @
d8068367
...
@@ -11,33 +11,10 @@ import tempfile
...
@@ -11,33 +11,10 @@ import tempfile
import
numpy
as
np
import
numpy
as
np
import
scipy.sparse
import
scipy.sparse
from
.libpath
import
find_lib_path
IS_PY3
=
(
sys
.
version_info
[
0
]
==
3
)
IS_PY3
=
(
sys
.
version_info
[
0
]
==
3
)
def
find_lib_path
():
"""Find the path to LightGBM library files.
Returns
-------
lib_path: list(string)
List of all found library path to LightGBM
"""
curr_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
os
.
path
.
expanduser
(
__file__
)))
dll_path
=
[
curr_path
,
os
.
path
.
join
(
curr_path
,
'../../lib/'
),
os
.
path
.
join
(
curr_path
,
'../../'
),
os
.
path
.
join
(
curr_path
,
'./lib/'
),
os
.
path
.
join
(
sys
.
prefix
,
'lightgbm'
)]
if
os
.
name
==
'nt'
:
dll_path
.
append
(
os
.
path
.
join
(
curr_path
,
'../../windows/x64/Dll/'
))
dll_path
.
append
(
os
.
path
.
join
(
curr_path
,
'./windows/x64/Dll/'
))
dll_path
=
[
os
.
path
.
join
(
p
,
'lib_lightgbm.dll'
)
for
p
in
dll_path
]
else
:
dll_path
=
[
os
.
path
.
join
(
p
,
'lib_lightgbm.so'
)
for
p
in
dll_path
]
lib_path
=
[
p
for
p
in
dll_path
if
os
.
path
.
exists
(
p
)
and
os
.
path
.
isfile
(
p
)]
if
not
lib_path
:
raise
Exception
(
'Cannot find lightgbm Library'
)
return
lib_path
def
_load_lib
():
def
_load_lib
():
"""Load LightGBM Library."""
"""Load LightGBM Library."""
lib_path
=
find_lib_path
()
lib_path
=
find_lib_path
()
...
...
python-package/lightgbm/libpath.py
0 → 100644
View file @
d8068367
import
os
import
platform
import
sys
def
find_lib_path
():
"""Find the path to LightGBM library files.
Returns
-------
lib_path: list(string)
List of all found library path to LightGBM
"""
curr_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
os
.
path
.
expanduser
(
__file__
)))
dll_path
=
[
curr_path
,
os
.
path
.
join
(
curr_path
,
'../../lib/'
),
os
.
path
.
join
(
curr_path
,
'../../'
),
os
.
path
.
join
(
curr_path
,
'./lib/'
),
os
.
path
.
join
(
sys
.
prefix
,
'lightgbm'
)]
if
os
.
name
==
'nt'
:
dll_path
.
append
(
os
.
path
.
join
(
curr_path
,
'../../windows/x64/Dll/'
))
dll_path
.
append
(
os
.
path
.
join
(
curr_path
,
'./windows/x64/Dll/'
))
dll_path
=
[
os
.
path
.
join
(
p
,
'lib_lightgbm.dll'
)
for
p
in
dll_path
]
else
:
dll_path
=
[
os
.
path
.
join
(
p
,
'lib_lightgbm.so'
)
for
p
in
dll_path
]
lib_path
=
[
p
for
p
in
dll_path
if
os
.
path
.
exists
(
p
)
and
os
.
path
.
isfile
(
p
)]
if
not
lib_path
:
raise
Exception
(
'Cannot find lightgbm Library'
)
return
lib_path
python-package/setup.py
0 → 100644
View file @
d8068367
# pylint: disable=invalid-name, exec-used
"""Setup lightgbm package."""
from
__future__
import
absolute_import
import
sys
import
os
from
setuptools
import
setup
,
find_packages
# import subprocess
sys
.
path
.
insert
(
0
,
'.'
)
CURRENT_DIR
=
os
.
path
.
dirname
(
__file__
)
libpath_py
=
os
.
path
.
join
(
CURRENT_DIR
,
'lightgbm/libpath.py'
)
libpath
=
{
'__file__'
:
libpath_py
}
exec
(
compile
(
open
(
libpath_py
,
"rb"
).
read
(),
libpath_py
,
'exec'
),
libpath
,
libpath
)
LIB_PATH
=
libpath
[
'find_lib_path'
]()
print
(
"Install lib_lightgbm from: %s"
%
LIB_PATH
)
# Please use setup_pip.py for generating and deploying pip installation
# detailed instruction in setup_pip.py
setup
(
name
=
'lightgbm'
,
version
=
open
(
os
.
path
.
join
(
CURRENT_DIR
,
'lightgbm/VERSION'
)).
read
().
strip
(),
description
=
"LightGBM Python Package"
,
install_requires
=
[
'numpy'
,
'scipy'
,
],
maintainer
=
'Guolin Ke'
,
maintainer_email
=
'guolin.ke@microsoft.com'
,
zip_safe
=
False
,
packages
=
find_packages
(),
include_package_data
=
True
,
data_files
=
[(
'lightgbm'
,
LIB_PATH
)],
url
=
'hhttps://github.com/Microsoft/LightGBM'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment