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

CI Run different sklearn versions in CI #196

Merged

Conversation

BenjaminBossan
Copy link
Collaborator

@BenjaminBossan BenjaminBossan commented Oct 18, 2022

Resolves #192

@BenjaminBossan
Copy link
Collaborator Author

@adrinjalali Some tests are now failing (of course). Any idea why we get:

E FutureWarning: Unlike other reduction functions (e.g. skew, kurtosis), the default behavior of mode typically preserves the axis it acts along. In SciPy 1.11.0, this behavior will change: the default value of keepdims will become False, the axis over which the statistic is taken will be eliminated, and the value None will no longer be accepted. Set keepdims to True or False to avoid this warning.

for sklearn nightly, but only on MacOS?

Also, on nightly, some sklearn import apparently triggers:

E numpy.distutils is deprecated since NumPy 1.23.0, as a result
E of the deprecation of distutils itself. It will be removed for
E Python >= 3.12. For older Python versions it will remain present.
E It is recommended to use setuptools < 60.0 for those Python versions.
E For more details, see:
E https://numpy.org/devdocs/reference/distutils_status_migration.html

It doesn't look like we're doing anything wrong here. Perhaps we have to let that specific deprecation slip?

@adrinjalali
Copy link
Member

the distutil warning we need to ignore. It's a ton of work on the sklearn side to migrate away from it, but that's not something we can do anything about.

The first one we can also ignore, but I'm not sure why it's only on MacOS. @ogrisel @thomasjpfan, anything we should care about here, or in sklearn?

@ogrisel
Copy link

ogrisel commented Oct 18, 2022

I don't understand either. Both use the same version of scipy 1.9.2 and this problem should have been fixed in scikit-learn dev in scikit-learn/scikit-learn#23633.

Maybe the scikit-learn dev wheels are not the same on all the platforms? Since we do not include the git commit hash in the version name, it's hard to tell.

@ogrisel
Copy link

ogrisel commented Oct 18, 2022

The macos nightly wheels have not been updated for more than 2 months!

https://anaconda.org/scipy-wheels-nightly/scikit-learn/files

The other wheels have not be updated for a few days because of scikit-learn/scikit-learn#24612 but this is a more recent problem.

@ogrisel
Copy link

ogrisel commented Oct 18, 2022

The macos nightly wheels have not been updated for more than 2 months!

Actually they have, it just that for macos we have older files such as scikit_learn-1.2.dev0-cp310-cp310-macosx_10_13_x86_64.whl that are favored by pip over the new and more backward compat files such as scikit_learn-1.2.dev0-cp310-cp310-macosx_10_9_x86_64.whl:

image

Let me delete the old macos files.

@ogrisel
Copy link

ogrisel commented Oct 18, 2022

Done. Feel free to push an empty commit to this PR to trigger the CI again and confirm that this fixed the problem.

@BenjaminBossan
Copy link
Collaborator Author

Yes, it was fixed, big thanks @ogrisel

pip uninstall --yes scikit-learn
if [ ${{ matrix.sklearn_version }} == "nightly" ];
then pip install --pre --extra-index https://pypi.anaconda.org/scipy-wheels-nightly/simple scikit-learn;
else pip install "scikit-learn>=${{ matrix.sklearn_version }}";
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this be

Suggested change
else pip install "scikit-learn>=${{ matrix.sklearn_version }}";
else pip install "scikit-learn=${{ matrix.sklearn_version }}";

?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I set the versions as "0.24,<1.0.dev0" etc. to get the latest patch version. Is there a better way, short of hard-coding it?

Copy link
Member

Choose a reason for hiding this comment

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

Right, then maybe this is better?

$ pip install scikit-learn~=1.0.0
Collecting scikit-learn~=1.0.0
  Downloading scikit_learn-1.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (26.5 MB)

https://peps.python.org/pep-0440/#compatible-release

Pulling a VW here: When detecting that the sklearn version is a dev
version (like the nightly build), skip the inference tests. This is
because the inference environment will fail to build the docker image
for those sklearn versions, as they're not on the conda package index.

Just installing with pip would not be a solution, because the sklearn
nightly build lives on a different index.
@BenjaminBossan
Copy link
Collaborator Author

@adrinjalali I added the skip for the inference tests when using a dev sklearn version

Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

Awesome, seems like it was easier than we thought!

pip uninstall --yes scikit-learn
if [ ${{ matrix.sklearn_version }} == "nightly" ];
then pip install --pre --extra-index https://pypi.anaconda.org/scipy-wheels-nightly/simple scikit-learn;
else pip install "scikit-learn>=${{ matrix.sklearn_version }}";
Copy link
Member

Choose a reason for hiding this comment

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

Right, then maybe this is better?

$ pip install scikit-learn~=1.0.0
Collecting scikit-learn~=1.0.0
  Downloading scikit_learn-1.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (26.5 MB)

https://peps.python.org/pep-0440/#compatible-release

@BenjaminBossan
Copy link
Collaborator Author

BenjaminBossan commented Oct 20, 2022

@adrinjalali TIL about ~=. I made the change and it looks good except for scikit-learn~=1.0, which results in:

Collecting scikit-learn~=1.0
  Using cached scikit_learn-1.1.2-cp38-cp38-win_amd64.whl (7.3 MB)

(here e.g.)

Any idea?

EDIT: Sorry, got it now, you have to indicate the patch version too, it works now.

Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

Perfect!

@adrinjalali adrinjalali changed the title [WIP] Run different sklearn versions in CI CI Run different sklearn versions in CI Oct 20, 2022
@adrinjalali adrinjalali merged commit bf8c2c1 into skops-dev:main Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider running CI on different sklearn versions
3 participants