Skip to content

[python-package] drop Python 3.6 support, add Python 3.12 - #6459

Merged
jameslamb merged 7 commits into
masterfrom
ci/drop-python36
May 27, 2024
Merged

jameslamb merged 7 commits into
masterfrom
ci/drop-python36

Conversation

@jameslamb

@jameslamb jameslamb commented May 18, 2024 •

Copy link
Copy Markdown
Member

Inspired by this discussion: #6375 (comment)

Proposes the following:

  • bump python-requires to >= 3.7
  • run the one "oldest versions of everything" job on Python 3.7 instead of Python 3.6
  • run most CI jobs on 1 minor version of Python newer than what it's currently on
    • which includes adding the first Python 3.12 jobs here!
  • narrowly pin dependencies in Python 3.8 jobs to a specific, known-working environment

Notes for Reviewers

Why these versions?

I picked the oldest versions where pip install run in the python:3.7 docker image found a wheel. Found that building those old versions scipy and pandas from their sdists failed with a variety of errors.

Summary:

Comment thread .github/workflows/cuda.yml Outdated
- method: source
compiler: gcc
python_version: "3.9"
python_version: "3.12"

@jameslamb jameslamb May 19, 2024 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

proposing swapping this one and the wheel task, so we're always testing newest CUDA together with newest Python

@jameslamb jameslamb changed the title WIP: [python-package] drop Python 3.6 support, add Python 3.12 [python-package] drop Python 3.6 support, add Python 3.12 May 19, 2024
@jameslamb
jameslamb marked this pull request as ready for review May 19, 2024 05:26

@borchero borchero left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@jameslamb

Copy link
Copy Markdown
Member Author

Thanks for the review!

For breaking changes like this, I'd like to try to get 2 reviews. @jmoralez I know you'd supported this general idea in #6375 (comment), could you take a look at this PR and let us know what you think about the choices I made here?

@jmoralez jmoralez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks great. Thanks!

@jameslamb

jameslamb commented May 24, 2024 •

Copy link
Copy Markdown
Member Author

hmmmmm all the gcc CUDA jobs are the CUDA 11.8 gcc job is failing with errors like this:

__________________ ERROR collecting tests/c_api_test/test_.py __________________
tests/c_api_test/test_.py:10: in <module>
    from lightgbm.basic import _LIB as LIB
/github/home/.local/lib/python3.10/site-packages/lightgbm/__init__.py:8: in <module>
    from .basic import Booster, Dataset, Sequence, register_logger
/github/home/.local/lib/python3.10/site-packages/lightgbm/basic.py:278: in <module>
    _LIB = _load_lib()
/github/home/.local/lib/python3.10/site-packages/lightgbm/basic.py:262: in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
/tmp/miniforge/envs/test-env/lib/python3.10/ctypes/__init__.py:452: in LoadLibrary
    return self._dlltype(name)
/tmp/miniforge/envs/test-env/lib/python3.10/ctypes/__init__.py:374: in __init__
    self._handle = _dlopen(self._name, mode)
E   OSError: libomp.so.5: cannot open shared object file: No such file or directory

(example build link)

I see this in the CMake logs:

-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")

It's surprising to see LightGBM linking against libomp, not libgomp, using gcc. I have a feeling this is a result of building inside a conda environment but not using conda's compilers (ref: #5106 (comment)).

I'm gonna push a commit setting LD_DEBUG=libs so we can see more information.

@jameslamb

Copy link
Copy Markdown
Member Author

I'm moving the testing of the CUDA CI issue to a separate PR, I don't think it's related to this PR's changes: #6465

@jameslamb

Copy link
Copy Markdown
Member Author

I've merged in #6465, which fixes the CUDA CI issues, and reverted all the debugging stuff I'd pushed here.

Will merge this once CI (hopefully) passes.

@jameslamb
jameslamb merged commit 69b5bd3 into master May 27, 2024
@jameslamb
jameslamb deleted the ci/drop-python36 branch May 27, 2024 20:27
@github-actions

Copy link
Copy Markdown
Contributor

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 May 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants