Intel® Developer Cloud
Help connecting to or getting started on Intel® Developer Cloud
101 Discussions

XGBoost Jupyter Notebook: ModuleNotFoundError: No module named 'sklearn'

TGWelcome
Novice
887 Views

I am beginning the XGboost Jupyter notebook exercise but get this error:

 

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[11], line 1
----> 1 import sklearn
      2 from sklearnex import patch_sklearn
      3 patch_sklearn()

ModuleNotFoundError: No module named 'sklearn'

 

 When I run this code:

 

import sklearn
from sklearnex import patch_sklearn
patch_sklearn()
#unpatch_sklearn()
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import pandas as pd
from pandas import MultiIndex, Int16Dtype # if you don't import in this order you will get a pandas.Int64Index fix for FutureWarning error.
import xgboost as xgb
import numpy as np
from time import perf_counter
print("XGB Version : ", xgb.__version__)
print("Scikit-Learn Version : ", sklearn.__version__)
print("Pandas Version : ", pd.__version__)

Apparently sklearn doesn't exist in the python kernel?

Labels (3)
0 Kudos
4 Replies
Zulkifli_Intel
Moderator
837 Views

Hi TGWelcome,

 

Thank you for reaching out to us.

 

We are investigating this issue and will update you soon.

 

 

Regards,

Zulkifli

 

0 Kudos
Zulkifli_Intel
Moderator
793 Views

Hi TGWelcome,

 

I just ran the training again and the error has been resolved. Please help to rerun the Intel AI Kit and XGBoost Jupyter Notebook and see if a similar issue persists on your side.

xgb.JPG

 

If the issue still persists, please do this and try:

python.png

and also remove ~/.local/lib/python3.9 if that is not required so that a clean local install would happen.

 

Regards,

Zulkifli 

 

0 Kudos
Zulkifli_Intel
Moderator
754 Views

Hi TGWelcome,


Are you able to run the AI Kit XGBoost Predictive Modeling training now? Please share with us the result from your end. 



Regards,

Zulkifli


0 Kudos
Zulkifli_Intel
Moderator
597 Views

Hi, this thread will no longer be monitored since we have provided a solution. If you need any additional information from Intel, please submit a new question.



Regards,

Zulkifli


0 Kudos
Reply