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

Bump min python version to 3.7 #5974

Closed

Conversation

oscarmcnulty
Copy link

The dependency scikit-build-core>=0.4.4 requires python >=3.7.

Attempting to install with pip install lightgbm will fail in python 3.6 env since it will attempt to install lighgbm=4.0.0 but then fail to find a package matching scikit-build-core>=0.4.4 (since none are compatible with python 3.6)

The dependency scikit-build-core>=0.4.4 requires python >=3.7. 

Attempting to install with `pip install lightgbm` will fail in python 3.6 env since it will attempt to install lighgbm=4.0.0 but then fail to find a package matching scikit-build-core>=0.4.4 (since none are compatible with python 3.6)
@jameslamb
Copy link
Collaborator

Thanks for your interest in LightGBM, and for taking the time to propose a change!

But we are not going to accept this proposal. It's an intentional choice to not yet raise the Python floor in this project's Python package above 3.6.

See these discussions for some examples:

Attempting to install with pip install lightgbm will fail in python 3.6 env

This isn't exactly true. More specifically, installing lightgbm from source will fail in a Python 3.6 environment, because scikit-build-core doesn't support that version of Python.

However... it is absolutely still possible to use lightgbm with Python 3.6 as long as you are in an environment the project produces wheels for.

We test that on every commit, see here:

- name: Create wheel
run: |
docker run \
--rm \
-v $(pwd):/opt/lgb-build \
-w /opt/lgb-build \
lightgbm/vsts-agent:manylinux_2_28_x86_64 \
/bin/bash -c 'PATH=/opt/miniforge/bin:$PATH sh ./build-python.sh bdist_wheel --nomp'
- name: Test compatibility
run: |
docker run \
--rm \
-v $(pwd):/opt/lgb-build \
-w /opt/lgb-build \
python:3.6 \
/bin/bash ./.ci/test-python-oldest.sh
.

For a simpler example showing what I'm describing, try the following:

docker run \
    --rm \
    python:3.6 \
    pip install 'lightgbm==4.0.0'

You'll see that PyPI serves back a wheel, that is successfully installed

Collecting lightgbm==4.0.0
  Downloading lightgbm-4.0.0-py3-none-manylinux_2_28_x86_64.whl (3.0 MB)
Collecting numpy
  Downloading numpy-1.19.5-cp36-cp36m-manylinux2010_x86_64.whl (14.8 MB)
Collecting scipy
  Downloading scipy-1.5.4-cp36-cp36m-manylinux1_x86_64.whl (25.9 MB)
Installing collected packages: numpy, scipy, lightgbm
Successfully installed lightgbm-4.0.0 numpy-1.19.5 scipy-1.5.4

@jameslamb jameslamb closed this Jul 14, 2023
@oscarmcnulty
Copy link
Author

Thanks for the quick response and confirming 3.6 is the intended min version.

For completeness - We are also using an old version of pip which is causing the wheel for manylinux_2_8_x86_64 to not be used.

A reproducible example on x86_64 is

docker run \
    --rm \
    python:3.6 \
    sh -c "pip install pip==20.2.2 && pip install lightgbm==4.0.0"

@jameslamb
Copy link
Collaborator

I see, thanks for that detail.

I'm sorry about that, but our options are limited by the upstream changes that have happened in in build, pip, and setuptools. Python packaging is moving away from setup.py files towards static build metadata, and older versions of pip and Python, from before those standards were so widely adopted, are simply incompatible with packages built in some of these new ways.

To try to help inform your decision, I just worked through the releases of pip from 20.2.2 to today to find the oldest one that supports lightgbm==4.0 on Python 3.6. Like this (changing pip version each time):

docker run \
    --rm \
    python:3.6 \
    sh -c " \
        pip install 'pip==20.3' \
        && pip install 'lightgbm==4.0' \
        && python -c 'import lightgbm; print(dir(lightgbm))' \
    "

If you're able to upgrade just a bit further to pip==20.3 (from November 2020), looks like that could work. Is that a possibility in your environment?

I'm sorry again for the inconvenience. There's significant discussion in #5061 and the things linked from it describing these topics in greater detail, if you'd like to better understand why lightgbm's build system changed in the way that it did.

@github-actions
Copy link

This pull request 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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants