# python learner "no module named sklearn

**URL:** <https://forum.knime.com/t/python-learner-no-module-named-sklearn/80942>\
**Category:** KNIME Extensions\
**Tags:** scripting\
**Created:** [July 6, 2024, 10:27pm UTC](https://forum.knime.com/t/python-learner-no-module-named-sklearn/80942 "2024-07-06T22:27:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xenis](https://forum-cdn.knime.com/user_avatar/forum.knime.com/xenis/32/84551_2.png) [@xenis](https://forum.knime.com/u/xenis)\
**Post date:** [July 6, 2024, 10:27pm UTC](https://forum.knime.com/t/python-learner-no-module-named-sklearn/80942/1 "2024-07-06T22:27:17Z")

</div>

in the new KNIME version 5.2.5 when I run the python learner I get the error  
“No module named ‘sklearn’”. In the version 5.2.0 it works.  
Can someone help?  
Thanks

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [July 7, 2024, 12:50pm UTC](https://forum.knime.com/t/python-learner-no-module-named-sklearn/80942/2 "2024-07-07T12:50:32Z")

</div>

@xenis welcome to the KNIME forum. Have you checked your Python extension? Maybe install it again?

> **[How to Set Up Your Python Extensions | KNIME](https://www.knime.com/blog/how-to-setup-the-python-extension/)**
>
> Here is a quick step by step guide on how to install Python, get it working in KNIME, and also configure the Python Deep Learning extensions. 

Also: would other Python scripts work and only spleen is missing. Maybe you can give us more context and maybe provide the error message and the log.

---

<div class="post-metadata">

**Author:** ![xenis](https://forum-cdn.knime.com/user_avatar/forum.knime.com/xenis/32/84551_2.png) [@xenis](https://forum.knime.com/u/xenis)\
**Post date:** [July 7, 2024, 2:49pm UTC](https://forum.knime.com/t/python-learner-no-module-named-sklearn/80942/3 "2024-07-07T14:49:06Z")

</div>

Hi, thanks for your prompt answer.  
The Python Script is working properly. The problem is the Python learner (legacy). The python extension (legacy) has been already installed. But if I run for examble this statement  
“from sklearn import tree” I get the error: "No module named ‘sklearn’  
Traceback (most recent call last):  
File “”, line 1, in   
ModuleNotFoundError: No module named ‘sklearn’.  
Other Statements like  
import pandas as pd #Import Library work well.  
Thanks for your feedback in advance

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [July 7, 2024, 4:56pm UTC](https://forum.knime.com/t/python-learner-no-module-named-sklearn/80942/4 "2024-07-07T16:56:53Z")

</div>

@xenis maybe switch to the new Python nodes. The Python extension already comes with sklearn so no need to work with [conda (although you could)](https://medium.com/low-code-for-advanced-data-science/knime-and-python-setting-up-and-managing-conda-environments-2ac217792539).

> **[Simple example to make a random forest model with new Python Scrip in KNIME...](https://hub.knime.com/mlauber71/spaces/Public/kn_example_python_iris_2022~HIFbIx26objNVR40/current-state)**
>
> Simple example to make a random forest model with new Python Scrip in KNIME 4.6 using the iris dataset. Saving and reusing the model with Pickle Also creating …

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [October 5, 2024, 4:57pm UTC](https://forum.knime.com/t/python-learner-no-module-named-sklearn/80942/5 "2024-10-05T16:57:42Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
