Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

No module named Sklearn

avatar
Rising Star

Hi all, I am practicing the feature in CDSW.

 

When trying to do an experiment,  I got an error in the session as below:

 

-------error-------

import pickle

import cdsw

model = pickle.load(open('model.pkl', 'rb'))

ModuleNotFoundError: No module named 'sklearn'

ModuleNotFoundError Traceback (most recent call last)
/tmp/ipykernel_115/2912545845.py in <module>
----> 1 model = pickle.load(open('model.pkl', 'rb'))

ModuleNotFoundError: No module named 'sklearn'

Engine exited with status 1.

-------error-------

 

However, in the Build session in Experiment, I see Sklearn is installed in the docker container.

 

-----build-log-----

Step 1/5 : FROM docker.repository.cloudera.com/cloudera/cdsw/ml-runtime-workbench-python3.8-standard:2022.11.2-b2
---> 7ffae291c607
Step 2/5 : WORKDIR /home/cdsw
---> 22e8b9772338
Removing intermediate container 404b7da93746
Step 3/5 : COPY sources /home/cdsw
---> 90d2c92ea316
Removing intermediate container 959005050d3c
Step 4/5 : RUN su cdsw -c "mkdir -p ${R_LIBS_USER:-/home/cdsw/R}" && chown -R cdsw:cdsw /home/cdsw && printf "%s\n" 'export ALL_PROXY="" HTTPS_PROXY="" HTTP_PROXY="" MAX_TEXT_LENGTH="9999999" NO_PROXY="" PYTHONPATH="/usr/local/lib/python2.7/site-packages:/usr/local/lib/python3.6/site-packages:/usr/local/lib/anaconda_python3/site-packages" all_proxy="" http_proxy="" https_proxy="" no_proxy="" && /bin/bash --login -c "${1}"' > /tmp/.buildenv && chmod u+x /tmp/.buildenv && chown cdsw:cdsw /tmp/.buildenv && chmod u+x "/home/cdsw/cdsw-build.sh" && su cdsw -c "PATH=${PATH} /tmp/.buildenv /home/cdsw/cdsw-build.sh" && :
---> Running in 0c052f60686b
Collecting sklearn
Downloading sklearn-0.0.post1.tar.gz (3.6 kB)
Building wheels for collected packages: sklearn
Building wheel for sklearn (setup.py): started
Building wheel for sklearn (setup.py): finished with status 'done'
Created wheel for sklearn: filename=sklearn-0.0.post1-py3-none-any.whl size=2343 sha256=8dbc420f70aee919b1d2719ee53b89f5822502f59707d87c14362581489fdccb
Stored in directory: /home/cdsw/.cache/pip/wheels/14/25/f7/1cc0956978ae479e75140219088deb7a36f60459df242b1a72
Successfully built sklearn
Installing collected packages: sklearn
Successfully installed sklearn-0.0.post1
---> 04c71dc6db3d
Removing intermediate container 0c052f60686b
Step 5/5 : CMD /bin/bash
---> Running in 561a448372ae
---> 4dcc7434f811
Removing intermediate container 561a448372ae
Successfully built 4dcc7434f811
Start Pushing image to [100.77.0.117:5000/4fcc178a-6e6e-4ed1-bd5b-7743775f9a5a]
Finish Pushing image to [100.77.0.117:5000/4fcc178a-6e6e-4ed1-bd5b-7743775f9a5a]

-----build-log-----

 

Therefore, I have  no idea why it fails. Could someone point out the reason for me please? Thank you.

1 ACCEPTED SOLUTION

avatar
Rising Star

I managed to fix the issue.

 

As I am using CDSW template, the library install be default is "sklearn". The correct library name should be "scikit-learn".

View solution in original post

1 REPLY 1

avatar
Rising Star

I managed to fix the issue.

 

As I am using CDSW template, the library install be default is "sklearn". The correct library name should be "scikit-learn".