Skip to content

Avoid pip wheel caching #4

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

Merged
merged 4 commits into from
Jan 25, 2023
Merged

Avoid pip wheel caching #4

merged 4 commits into from
Jan 25, 2023

Conversation

lesteve
Copy link
Member

@lesteve lesteve commented Dec 1, 2022

Currently a wheel is built on the first download and then reused on the next pip install sklearn it could potentially mean that people are unaware of the sklearn package deprecation, since they keep reusing the locally cached wheel.

At the same time most downloads are probably coming from CIs without pip caching so this may not be that important if the goal is to reduce sklearn downloads.

Downsides:

  • the output is a bit more complicated in the case of succesful install, see below, but this is only a warning and most people will ignore it.
❯ pip install .
Processing /home/lesteve/dev/sklearn-pypi-package
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: sklearn
  Building wheel for sklearn (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [2 lines of output]
      running bdist_wheel
      error: This is an expected error. Buidling wheel is disabled for the sklearn package to avoid client-side pip caching.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for sklearn
  Running setup.py clean for sklearn
Failed to build sklearn
Installing collected packages: sklearn
  Attempting uninstall: sklearn
    Found existing installation: sklearn 0.0.post1
    Uninstalling sklearn-0.0.post1:
      Successfully uninstalled sklearn-0.0.post1
  Running setup.py install for sklearn ... done
  DEPRECATION: sklearn was installed using the legacy 'setup.py install' method, because a wheel could not be built for it. A possible replacement is to fix the wheel build issue reported above. Discussion can be found at https://github.com/pypa/pip/issues/8368
Successfully installed sklearn-0.0.post1
  • it would also require a new release e.g. 0.0.post2, which complicates the situation a bit more ...
  • this seems a bit of a hack and I am not quite sure how robust this is

@lesteve
Copy link
Member Author

lesteve commented Dec 1, 2022

I improved the error message. For now I am still undecided about merging this, my plan in opening the PR was to have it ready in case we decide this is worth it.

Copy link
Member

@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

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

Thank you, @lesteve!

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

LGTM as well. +1 for releasing 0.0.post2 after merging this.

@lesteve lesteve merged commit 6db9507 into main Jan 25, 2023
@lesteve lesteve deleted the avoid-pip-wheel-caching branch January 25, 2023 07:50
@lesteve
Copy link
Member Author

lesteve commented Jan 25, 2023

FYI I have released 0.0.post2 on PyPI

@GaelVaroquaux
Copy link
Member

GaelVaroquaux commented Jan 25, 2023 via email

@ghost
Copy link

ghost commented Jan 25, 2023

If the build of Wheel for sklearn is failed, how does sklearn gets installed?

Our build pulled sklearn-0.0.post2 from PyPI and failed to install it:

Processing /root/.cache/pypoetry/artifacts/13/18/3a/0416ffea606e5c8e88483e7ca6a8134dc8c16baa5aa684f07d5e8b2912/sklearn-0.0.post2.tar.gz
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Preparing metadata (pyproject.toml): finished with status 'done'
  Building wheels for collected packages: sklearn
    Building wheel for sklearn (pyproject.toml): started
    Building wheel for sklearn (pyproject.toml): finished with status 'error'
    error: subprocess-exited-with-error
    × Building wheel for sklearn (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [4 lines of output]
        running bdist_wheel
        error: This is an expected error. Building wheel is disabled for the deprecated sklearn PyPI package to avoid pip caching.
        For more details about the sklearn PyPI package deprecation, see:
        https://github.com/scikit-learn/sklearn-pypi-package
        [end of output]
    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for sklearn
  Failed to build sklearn
  ERROR: Could not build wheels for sklearn, which is required to install pyproject.toml-based projects

@oailton
Copy link

oailton commented Jan 25, 2023

@Haizhou-W Why don't you use the scikit-learn package instead of the deprecated sklearn?

@ghost
Copy link

ghost commented Jan 26, 2023

We need to do thorough testing before switch to use scikit-learn. Currently, our dependency on sklearn is specified as sklearn = "*", which picks up 0.0.post2 automatically and resulted in the above error message.

Would scikit-learn be a drop-in replacement for sklearn?

@IPanfilov
Copy link

@Haizhou-W I had the same problem. Before switching to scikit learn, I was able to run old code by pinning the version of sklearn to 0.0

@lesteve
Copy link
Member Author

lesteve commented Jan 26, 2023

@Haizhou-W @IPanfilov please use scikit-learn, all your code will work exactly the same, 100% guaranteed.

scikit-learn has always been the real package name. sklearn is a package which does not contain any code and whose only role is to depend on scikit-learn so that when you do pip install sklearn you actually get the scikit-learn package.

We have started deprecating sklearn, for more details look at https://github.com/scikit-learn/sklearn-pypi-package

@lesteve
Copy link
Member Author

lesteve commented Jan 26, 2023

OK I am not very familiar with poetry but it does seem like the 0.0.post2 release breaks poetry install because poetry does not do fall-back to the legacy install contrary to pip ...

@lesteve
Copy link
Member Author

lesteve commented Jan 27, 2023

There does not seem to be a way to do what we wanted, we decided to revert this PR and yank the 0.0.post2 release from PyPI.

lesteve added a commit that referenced this pull request Jan 27, 2023
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.

6 participants