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

Cleanup cuML ImportError message #3423

Merged
merged 1 commit into from Mar 22, 2023

Conversation

beckernick
Copy link
Contributor

@beckernick beckernick commented Mar 22, 2023

Related Issue or bug

Closes #3422

Describe the changes you've made

This PR updates the ImportError message when using use_gpu="force" and cuML is not available. The message "Install or update cuML to be >= 22.10" is clear enough without trying to reference the current version installed.

It also adds a note about installation instructions.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, local variables)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested locally by creating a fresh environment and installing PyCaret via pip, via Github (master branch), and via this PR's local branch.

mamba create -n pycaret -c conda-forge python=3.10 jupyterlab ipython
conda activate pycaret
# cd to local branch
python -m pip install .
from pycaret.datasets import get_data
data = get_data('diabetes')

from pycaret.classification import *
s = setup(data, target = 'Class variable', use_gpu="force")
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Input In [3], in <cell line: 5>()
      2 data = get_data('diabetes')
      4 from pycaret.classification import *
----> 5 s = setup(data, target = 'Class variable', use_gpu="force")

File ~/NVIDIA/pycaret/pycaret/classification/functional.py:603, in setup(data, data_func, target, index, train_size, test_data, ordinal_features, numeric_features, categorical_features, date_features, text_features, ignore_features, keep_features, preprocess, create_date_columns, imputation_type, numeric_imputation, categorical_imputation, iterative_imputation_iters, numeric_iterative_imputer, categorical_iterative_imputer, text_features_method, max_encoding_ohe, encoding_method, rare_to_value, rare_value, polynomial_features, polynomial_degree, low_variance_threshold, group_features, group_names, drop_groups, remove_multicollinearity, multicollinearity_threshold, bin_numeric_features, remove_outliers, outliers_method, outliers_threshold, fix_imbalance, fix_imbalance_method, transformation, transformation_method, normalize, normalize_method, pca, pca_method, pca_components, feature_selection, feature_selection_method, feature_selection_estimator, n_features_to_select, custom_pipeline, custom_pipeline_position, data_split_shuffle, data_split_stratify, fold_strategy, fold, fold_shuffle, fold_groups, n_jobs, use_gpu, html, session_id, system_log, log_experiment, experiment_name, experiment_custom_tags, log_plots, log_profile, log_data, verbose, memory, profile, profile_kwargs)
...
File ~/NVIDIA/pycaret/pycaret/internal/pycaret_experiment/tabular_experiment.py:363, in _TabularExperiment._initialize_setup(self, n_jobs, use_gpu, html, session_id, system_log, log_experiment, experiment_name, memory, verbose)
    360 message = """cuML is outdated or not found. Required version is >=22.10.
    361 Please visit https://rapids.ai/ for installation instructions."""
    362 if use_gpu == "force":
--> 363     raise ImportError(message)
    364 else:
    365     self.logger.warning(message)

ImportError: cuML is outdated or not found. Required version is >=22.10.
                Please visit https://rapids.ai/ for installation instructions.

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

Describe if there is any unusual behaviour of your code(Write NA if there isn't)

NA

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

(Assuming additional tests are not needed).

Screenshots

Original Updated
original screenshot updated screenshot

@beckernick beckernick changed the title Cleanup cuML ImportError information Cleanup cuML ImportError message Mar 22, 2023
@ngupta23 ngupta23 added the gpu label Mar 22, 2023
@ngupta23 ngupta23 added this to the pycaret 3.1.0 milestone Mar 22, 2023
@Yard1 Yard1 self-requested a review March 22, 2023 17:38
@Yard1
Copy link
Member

Yard1 commented Mar 22, 2023

Thanks!

@Yard1 Yard1 merged commit ce4c703 into pycaret:master Mar 22, 2023
14 checks passed
@ngupta23 ngupta23 modified the milestones: 3.1.0, 3.0.1 Apr 21, 2023
@@ -357,7 +357,8 @@ def _initialize_setup(
if cuml_version is None or not version.parse(cuml_version) >= version.parse(
"22.10"
):
message = f"cuML is outdated or not found. Required version is >=22.10, got {__version__}"
message = """cuML is outdated or not found. Required version is >=22.10.
Copy link
Contributor

Choose a reason for hiding this comment

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

Windows can´t use cuml package, so we need to do someting about this: Windows should not have this message!
I created a PR to fix warnings about cuml package on windows.
PR: #3881

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: PyCaret ImportError displays incorrect version when cuML isn't available and use_gpu="force"
4 participants