Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python-package] add 'pandas' extra #5937

Merged
merged 3 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions python-package/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,28 @@ For **macOS** (we provide wheels for 3 newest macOS versions) users:

- For version smaller than 2.1.2, **gcc-7** with **OpenMP** is required.

Use LightGBM with Dask
**********************

.. warning::

Dask-package is only tested on Linux.

To install all dependencies needed to use ``lightgbm.dask``, append ``[dask]``.

.. code:: sh

pip install 'lightgbm[dask]'

Use LightGBM with pandas
************************

To install all dependencies needed to use ``pandas`` in LightGBM, append ``[pandas]``.

.. code:: sh

pip install 'lightgbm[pandas]'

Build from Sources
******************

Expand Down Expand Up @@ -242,21 +264,6 @@ Then install the Python package using that library.

sh ./build-python.sh install --precompile

Install Dask-package
''''''''''''''''''''

.. warning::

Dask-package is only tested on Linux.

To install all additional dependencies required for Dask-package, you can append ``[dask]`` to LightGBM package name:

.. code:: sh

pip install lightgbm[dask]

Or replace ``sh ./build-python.sh install`` with ``pip install -e .[dask]`` if you are installing the package from source files.

Troubleshooting
---------------

Expand Down
9 changes: 9 additions & 0 deletions python-package/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ readme = "README.rst"
requires-python = ">=3.6"
version = "3.3.5.99"

[project.optional-dependencies]
dask = [
"dask[array,dataframe,distributed]>=2.0.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format where these are split out as individual items

dask[array]>=2.0.0
dask[dataframe]>=2.0.0
dask[distributed]>=2.0.0

Is confusing. It makes it seem like 3 separate versions of 3 separate things, which just happen to be the same... but that's not really what it means.

That is 3 different ways to say dask >= 2.0.0.

We should just use a single number, to make that clearer.

"pandas>=0.24.0"
]
pandas = [
"pandas>=0.24.0"
]

[project.urls]
homepage = "https://github.com/microsoft/LightGBM"
documentation = "https://lightgbm.readthedocs.io/en/latest/"
Expand Down
7 changes: 0 additions & 7 deletions python-package/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ install_requires =
scikit-learn!=0.22.0
scipy

[options.extras_require]
dask =
dask[array]>=2.0.0
dask[dataframe]>=2.0.0
dask[distributed]>=2.0.0
pandas

[options.packages.find]
where = lightgbm

Expand Down