Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

CDSW - ModuleNotFoundError: No module named 'sklearn'

Highlighted

CDSW - ModuleNotFoundError: No module named 'sklearn'

New Contributor

hi
a newbie question...
i'm trying to follow the guide here (using CDSW 1.7) : https://www.cloudera.com/tutorials/building-a-linear-regression-model-for-predicting-house-prices.ht...

when i add the following 

 

import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.datasets import load_boston
from sklearn.metrics import mean_squared_error, r2_score

 

 

i get the ModuleNotFoundError :

ModuleNotFoundError: No module named 'sklearn'
ModuleNotFoundError Traceback (most recent call last) in engine ----> 1 from sklearn.model_selection import train_test_split ModuleNotFoundError: No module named 'sklearn'

 how can i solve this?

thanks

1 REPLY 1

Re: CDSW - ModuleNotFoundError: No module named 'sklearn'

Rising Star

You can do this:

 

!pip3 install sklearn

 

This will install the needed package. Note that ! is a magic command that executes the command not in your Python session but in the underlying OS environment. 

Don't have an account?
Coming from Hortonworks? Activate your account here