diff --git a/examples/python-guide/dask/binary-classification.py b/examples/python-guide/dask/binary-classification.py index 4313e8da3ddb..d86fe3536df5 100644 --- a/examples/python-guide/dask/binary-classification.py +++ b/examples/python-guide/dask/binary-classification.py @@ -1,3 +1,5 @@ +import sys + import dask.array as da from distributed import Client, LocalCluster from sklearn.datasets import make_blobs @@ -5,6 +7,9 @@ import lightgbm as lgb if __name__ == "__main__": + if not sys.platform.startswith('linux'): + print('lightgbm.dask is currently supported in Linux environments') + sys.exit(0) print("loading data") diff --git a/examples/python-guide/dask/multiclass-classification.py b/examples/python-guide/dask/multiclass-classification.py index 8e40b35a8121..f17de98f2a84 100644 --- a/examples/python-guide/dask/multiclass-classification.py +++ b/examples/python-guide/dask/multiclass-classification.py @@ -1,3 +1,5 @@ +import sys + import dask.array as da from distributed import Client, LocalCluster from sklearn.datasets import make_blobs @@ -5,6 +7,9 @@ import lightgbm as lgb if __name__ == "__main__": + if not sys.platform.startswith('linux'): + print('lightgbm.dask is currently supported in Linux environments') + sys.exit(0) print("loading data") diff --git a/examples/python-guide/dask/prediction.py b/examples/python-guide/dask/prediction.py index 64e2bae0c08d..19c6ad75b51f 100644 --- a/examples/python-guide/dask/prediction.py +++ b/examples/python-guide/dask/prediction.py @@ -1,3 +1,5 @@ +import sys + import dask.array as da from distributed import Client, LocalCluster from sklearn.datasets import make_regression @@ -6,6 +8,9 @@ import lightgbm as lgb if __name__ == "__main__": + if not sys.platform.startswith('linux'): + print('lightgbm.dask is currently supported in Linux environments') + sys.exit(0) print("loading data") diff --git a/examples/python-guide/dask/ranking.py b/examples/python-guide/dask/ranking.py index b7cae20a44c4..67b1080d2515 100644 --- a/examples/python-guide/dask/ranking.py +++ b/examples/python-guide/dask/ranking.py @@ -1,3 +1,6 @@ +import os +import sys + import dask.array as da import numpy as np from distributed import Client, LocalCluster @@ -6,11 +9,16 @@ import lightgbm as lgb if __name__ == "__main__": + if not sys.platform.startswith('linux'): + print('lightgbm.dask is currently supported in Linux environments') + sys.exit(0) print("loading data") - X, y = load_svmlight_file("../lambdarank/rank.train") - group = np.loadtxt("../lambdarank/rank.train.query") + X, y = load_svmlight_file(os.path.join(os.path.dirname(os.path.realpath(__file__)), + '../../lambdarank/rank.train')) + group = np.loadtxt(os.path.join(os.path.dirname(os.path.realpath(__file__)), + '../../lambdarank/rank.train.query')) print("initializing a Dask cluster") diff --git a/examples/python-guide/dask/regression.py b/examples/python-guide/dask/regression.py index 69a8f764732d..5c2766a3d947 100644 --- a/examples/python-guide/dask/regression.py +++ b/examples/python-guide/dask/regression.py @@ -1,3 +1,5 @@ +import sys + import dask.array as da from distributed import Client, LocalCluster from sklearn.datasets import make_regression @@ -5,6 +7,9 @@ import lightgbm as lgb if __name__ == "__main__": + if not sys.platform.startswith('linux'): + print('lightgbm.dask is currently supported in Linux environments') + sys.exit(0) print("loading data")