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

Fix differing versions of dependency scikit-learn #313

Closed
ckunki opened this issue Aug 8, 2024 · 1 comment · Fixed by #316
Closed

Fix differing versions of dependency scikit-learn #313

ckunki opened this issue Aug 8, 2024 · 1 comment · Fixed by #316
Assignees
Labels
bug Unwanted / harmful behavior

Comments

@ckunki
Copy link
Contributor

ckunki commented Aug 8, 2024

Solution strategy

Add cells to AI-Lab notebook nbtest_sklearn.py

  • Detect scikit-learn versions inside the database SLC and in the AI-Lab
  • If different then call Jupyter magic pip to replace the AI-Lab version with the one used in the SLC:
%pip install "scikit_learn=={slc_version}"

Notes

  • This requires pip to be available in the PATH, see Add jupyterenv to PATH  #273
  • This should also enable fixing the notebook tests as these can run all cells in a notebook including the cell fixing the scikit-learn version

Sample Snippets

Checking the version of sklearn in a shell

python -c "import sklearn; print(sklearn.__version__)"

Installing sklearn:

python3 -m pip install "scikit_learn==1.4.2"

Sample UDF for detecting scikit-learn version inside the database SLC

--/
CREATE OR REPLACE PYTHON3 SCALAR SCRIPT detect_skikit_learn_version() RETURNS VARCHAR(100) AS
import sklearn
def run(ctx):
    return sklearn.__version__ 
/

select detect_skikit_learn_version();

Background

During implementation of #301, PR #311 showed an error when running nbtest_sklearn.py

FAILURES ... test_regression[StorageBackend.saas]
AttributeError: 'OneHotEncoder' object has no attribute '_infrequent_enabled'

Stage scikit-learn version cloudpickle
SaaS prod 1.0.2 not installed
SaaS staging 1.4.2 installed
Docker DB (unknown) (unknown)

Other options

@ckunki ckunki self-assigned this Aug 8, 2024
@ckunki ckunki added the bug Unwanted / harmful behavior label Aug 8, 2024
@ckunki
Copy link
Contributor Author

ckunki commented Aug 8, 2024

The following zip contains an SQL script for running pip and the results of pip list on different stages.
sql.zip

@ckunki ckunki changed the title Fix differing versions of dependency sciki-learn Fix differing versions of dependency scikit-learn Aug 14, 2024
ckunki added a commit that referenced this issue Aug 20, 2024
* #313: Enabled fixing differing versions of dependency scikit-learn
* Added functionality to notebook sklearn_fix_version
* Updated notebook test
* Fixed sk_train to remove feature labels
* [CodeBuild]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unwanted / harmful behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant