Skip to content

Conversation

@Yacklin
Copy link
Contributor

@Yacklin Yacklin commented Nov 6, 2025

What does this PR do?

(Pattern of PR for transformers is reused)
It corrects problematic pip commands generated by _download_additional_moddules when it prompts the users to install scikit-learn.

Before changes, it would prompt the user to install sklearn (deprecated, now called scikit-learn) with 'pip install sklearn' being displayed. Running 'pip install sklearn' would raise error.
reminding_to_install_sklearn
execution_for_pip_sklearn

To make it ready-to-use for users, this Pull Request is created.
This Pull Request adds one line (and correct a tiny typo) to make sure library_import_path is set to "scikit-learn" when installing scikit-learn and 'pip install scikit-learn', the correct command, would be displayed.

Who can review?

@lhoestq
@sgugger

@Rocketknight1
(sorry to bother you, but this repo looks less active compared with Transformers. I believe you have write access to all repos in huggingface and you are the first one who approved my pr in transformers, so i would like to let you know.)

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@Rocketknight1
Copy link
Member

I'll leave this one for the evaluate team for now, feel free to ping me if you don't hear anything in a week or so for this one or #716!

Comment on lines 262 to +263
library_import_name = "scikit-learn" if library_import_name == "sklearn" else library_import_name
library_import_path = "scikit-learn" if library_import_path == "sklearn" else library_import_path
Copy link
Member

Choose a reason for hiding this comment

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

this duplicate line doesn't seem to fix anything, can you check again ?

Copy link
Contributor Author

@Yacklin Yacklin Nov 11, 2025

Choose a reason for hiding this comment

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

Hi @lhoestq , the first line changes the variable library_import_name, which changes the package name displayed in "dependency['']". The second line changes the library_import_path, which changes the package name displayed in "pip install".

Please carefully view the screenshot i attached in this Pull Request.

To make sure you can see it clearly, please find the attached.

This is

NOT

DUPLICATE

LINE

!!!!!!!!!!!!!!!!!
Annotation 2025-11-11 092318

Copy link
Contributor Author

@Yacklin Yacklin Nov 11, 2025

Choose a reason for hiding this comment

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

Hi @lhoestq ,

To make sure you can view it clearly, i added some notes for you.
ss_edited

In the image above, the "1" is controlled by 'import_library_name' and the "2" (displayed in pip commands) is controlled by 'import_library_path'. If you forget how it works, please read source code carefully.

The library_import_name only changes the package names within 'dependency['']'.
But it doesn't change the package name in "pip install".

So i added a new line (please read it CAREFULLY!!!!!!!!!! THIS IS NOT DUPLICATE LINE!!!!!!!!!!!!!!!!!!)
library_import_path (IT'S PATH!!!!!)
so that the package name, in this context, scikit-learn, could be displayed correctly in "pip install".

Copy link
Member

Choose a reason for hiding this comment

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

Noted thanks, no need for violence in your message.

Will approve and merge your PRs soon

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you so much

@Yacklin
Copy link
Contributor Author

Yacklin commented Nov 14, 2025

Hi @lhoestq , please close this PR because one folk seems to have a better fix than mine #717

@lhoestq lhoestq merged commit c33f40c into huggingface:main Nov 14, 2025
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.

3 participants