[python-package] Remove dead Python 2 guard and sklearn.cross_validation fallback#12107
Closed
RAMitchell wants to merge 4 commits intodmlc:masterfrom
Closed
[python-package] Remove dead Python 2 guard and sklearn.cross_validation fallback#12107RAMitchell wants to merge 4 commits intodmlc:masterfrom
RAMitchell wants to merge 4 commits intodmlc:masterfrom
Conversation
- Remove `assert sys.version_info[0] == 3` — XGBoost requires Python >= 3.10 (pyproject.toml), making this check dead code. Using `assert` for version checks is also incorrect as assertions are stripped under `python -O`. - Remove `sklearn.cross_validation` import fallback — `sklearn.cross_validation` was removed in scikit-learn 0.20 (2018). Any scikit-learn version supporting Python 3.10+ will have `sklearn.model_selection`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This supersedes PR #12086 with the same Python-package cleanup plus a fix for the macOS x86_64 wheel CI failure.
The original change removes dead compatibility code in
compat.py:sklearn.cross_validationfallbackAdditional CI Fix
The failing job was:
Build macOS wheel (macosx_x86_64)delocatefailed while repairing the wheel becauselibxgboost.dylibpicked up Homebrew LLVM'slibunwind.1.0.dylib, and that dependency requires macOS 14.0 even though the wheel target is macOS 10.15.On the macOS Intel runner, the wheel build was resolving OpenMP through Homebrew. That in turn introduced a dependency on Homebrew LLVM's
libunwind, which caused wheel repair to fail with:This PR makes the macOS wheel build prefer Conda's
llvm-openmpruntime instead of relying on Homebrew's OpenMP path:llvm-openmpin the Conda environment during macOS wheel buildsCMAKE_PREFIX_PATH=$CONDA_PREFIXfor the wheel buildFindOpenMPMacOS.cmaketo prefer$CONDA_PREFIX/lib/libomp.dylibwhen availableThis avoids pulling Homebrew LLVM's
libunwindinto the wheel repair step and preserves the existing macOS 10.15 deployment target.Why not bump the deployment target?
A simpler workaround would be to raise the Intel macOS wheel target from 10.15 to 14.0, but that would be a significant compatibility drop for macOS x86_64 users. This change keeps the current support target intact and fixes the dependency resolution instead.