-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[RFC] [python] 'setup.py install' is deprecated #5061
Comments
Oh, it's a rabbit hole! Linking some more related discussions:
TL;DR: the future of Python building system is extremely foggy. |
Thanks for those links @StrikerRUS ! I think |
Recently released scipy 1.9.0 is the first version built with Meson: http://scipy.github.io/devdocs/release.1.9.0.html#scipy-switched-to-meson-as-its-build-system. |
Hi, I tried with pip as the warning suggests as follows: Instead of
I ran, in the LightGBM/python-package folder
The --user param is probably not necessary in all cases, but on the machine I'm working is required since site-packages folder is at a specific location specified in the USER_SITE variable. You can try without it, but if you run pip list and don't see lightgbm, try adding the --user param. And with this there is no warning and works fine. |
it's work for me
|
Thank you, but "just pin to a 1+-year-old version of |
But I think this adds new urgency to the project to switch If no one else picks it up, I'll try working on that after resolving #5514 . |
Adding more deprecation warnings noticed in one of the CUDA builds today (build link).
|
Adding that there is also a PEP 517 backend for LightGBM's LightGBM/python-package/setup.py Lines 174 to 188 in d067ab6
|
Assigning this to myself. I've started working on it on my fork. |
I believe that means that as of the next I'll prioritize #5759 this week...on that PR, I have a working setup for building source distributions that don't require
Will |
That release also deprecated https://pip.pypa.io/en/stable/news/ This adds new urgency to this work. I'll continue with #5759 this week and hopefully have it ready for review soon. |
Also want to add that |
For those following along here, we just took an important step... LightGBM is no longer support running Instead, to customize installation of the Python package from a clone of this git repo, we now encourage the use of a shell script run from the root of the repo. For example: sh ./build-python.sh install --cuda The next release of LightGBM will also include a source distribution published to PyPI which can be passed similar customization flags via In future PRs, LightGBM's |
The warnings from Python build tools about not using
|
Running with `logging.level = "DEBUG"`, `scikit-build-core` emits a log message listing environment variables for the build, like this: ```text 2023-06-05 00:48:26,822 - scikit_build_core - DEBUG - RUNENV: SYSTEM_PULLREQUEST_SOURCECOMMITID=77b0ed1470cbf63d39ddae10915e96cea2804783 BUILD_QUEUEDBY=Microsoft.VisualStudio.Services.TFS CONDA_SHLVL=1 LC_ALL=en_US.UTF-8 LD_LIBRARY_PATH=/usr/local/lib64:/opt/rh/gcc-toolset-12/root/usr/lib64:/opt/rh/gcc-toolset-12/root/usr/lib:/opt/rh/gcc-toolset-12/root/usr/lib64/dyninst:/opt/rh/ gcc-toolset-12/root/usr/lib/dyninst:/usr/local/lib CONDA_EXE=/opt/miniforge/bin/conda AGENT_HOMEDIRECTORY=/__a SYSTEM_POSTLINESSPEED=10000 AGENT_USEWORKSPACEID=true SYSTEM_STAGEDISPLAYNAME=__default AGENT_VERSION=3.220.2 SYSTEM_JOBATTEMPT=1 SYSTEM_TEAMFOUNDATIONSERVERURI=https://dev.azure.com/lightgbm-ci/ AGENT_TOOLSDIRECTORY=/__t INPUT_ARGUMENTS= SYSTEM_DEFINITIONID=1 AGENT_DISABLELOGPLUGIN_TESTFILEPUBLISHERPLUGIN=true LANG=en_US.UTF-8 ... ``` I've found that very useful when trying to debug build issues in a project I'm working on (microsoft/LightGBM#5061). This PR proposes a change that I think might make it even more useful...sorting that output alphabetically, like this: ```text 2023-06-05 00:48:26,822 - scikit_build_core - DEBUG - RUNENV: AGENT_DISABLELOGPLUGIN_TESTFILEPUBLISHERPLUGIN=true AGENT_HOMEDIRECTORY=/__a AGENT_TOOLSDIRECTORY=/__t AGENT_USEWORKSPACEID=true AGENT_VERSION=3.220.2 BUILD_QUEUEDBY=Microsoft.VisualStudio.Services.TFS CONDA_EXE=/opt/miniforge/bin/conda CONDA_SHLVL=1 INPUT_ARGUMENTS= LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LD_LIBRARY_PATH=/usr/local/lib64:/opt/rh/gcc-toolset-12/root/usr/lib64:/opt/rh/gcc-toolset-12/root/usr/lib:/opt/rh/gcc-toolset-12/root/usr/lib64/dyninst:/opt/rh/gcc-toolset-12/root/usr/lib/dyninst:/usr/local/lib SYSTEM_DEFINITIONID=1 SYSTEM_JOBATTEMPT=1 SYSTEM_POSTLINESSPEED=10000 SYSTEM_PULLREQUEST_SOURCECOMMITID=77b0ed1470cbf63d39ddae10915e96cea2804783 SYSTEM_STAGEDISPLAYNAME=__default SYSTEM_TEAMFOUNDATIONSERVERURI=https://dev.azure.com/lightgbm-ci/ ``` In addition to making the output a bit easier to scan visually (in my opinion), that also makes the use of text-diffing tools to compare log output a bit easier. Thanks very much for your time and consideration. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Please note that this workaround no longer works, since the deprecated argument I believe the only option left is to use the build script from the LightGBM repo: |
This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
Description
Running
python setup.py install
for the Python package raises the following deprecation warning:I found a very detailed write-up explaining this issue: "Why you shouldn't invoke setup.py directly" (October 2021).
Here are some of the main things we need to know:
Reproducible example
I observed this warning building from source on macOS 12.2.1, with Python v3.9.7 and
setuptools==59.8.0
.git clone --recursive https://github.com/microsoft/LightGBM.git cd LightGBM/python-package
This warning is raised with
python setup.py install
.It is also raised with
pip
.pip install -v .
You can also see this warning on LightGBM's CI builds that use
python setup.py {command}
. For example, the most recentLinux regular
job running on Azure DevOps (build link).References
This warning was added in
setuptools=v58.3.0
(October 22, 2021), pypa/setuptools#2824.That PR mentions https://www.python.org/dev/peps/pep-0517/ as a description of the standard packages should meet to continue to be compliant with the main Python package management tools.
The warning comes from
setuptools.command.install.initialize_options()
: https://github.com/pypa/setuptools/blob/391bb5d4d09c9eb8d6b2b98968e623455ae0a384/setuptools/command/install.py#L32-L38.lightgbm
currently sub-classessetuptools.command.install
to customize the behavior ofsetup.py install
.LightGBM/python-package/setup.py
Lines 220 to 225 in f6d654b
It also does that to customize
setup.py {install_lib, bdist_wheel, sdist}
.LightGBM/python-package/setup.py
Lines 361 to 366 in f6d654b
Why does this matter?
If nothing is changed, the LightGBM Python package might eventually not be installable with some future versions of Python /
setuptools
.What should be done?
I don't have a recommendation yet.
https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html, https://www.python.org/dev/peps/pep-0517/, and the other things they link to are very detailed and I'm not deeply familiar with the details of how
setuptools
works.Just opening this up to track discussion about this issue.
The text was updated successfully, but these errors were encountered: