Sklearn which is also known as Scikit-learn is a Python module that is used for machine learning models’ training, evaluation, data preprocessing, and tuning of models. It is very important to know which version of the Sklearn module is installed on your system because every version has its own specific function. It is highly recommended to install the latest version of the Sklearn module to enjoy all the functionalities. In this short article, we will learn how to check Sklearn version in Python on various platforms including Windows and Linux.
How to Check Sklearn Version in Python?
In general, the .__version__ is used to find the versions of installed modules. First make sure that you have installed the Sklearn module on your system. Then follow the given steps to check the version of Sklearn installed on your system.
- Open the notebook or text editor
- Import the Scikit-learn module (import sklearn)
- Type ‘sklearn.__version__’ and it will return the version of the sklearn module
Type the following command and run the Python file.
import sklearn
print(sklearn.__version__)
1.2.2
As you can see, in my case, I have the latest version of Sklearn installed on my system.
Check Sklearn Version on Windows
On windows, it is very simple to find the version of the installed modules on your system. The pip command is not only used to install the modules but also used to list the installed modules along with their versions. We can use the pip3 list command to list all the installed modules and find the Sklearn in that list:
- Open the terminal on Windows
- Type the command “pip3 list | findstr scikit“
- Output: “scikit-learn 1.2.2“
pip3 list | findstr scikit
This will display the version of the installed module.
Check the Version of Sklearn on Anaconda
Finding the version of Sklearn on Anaconda is very much similar to finding it on Windows. You need to type the same commands with a few changes.
- Open the terminal of Anaconda
- Type “conda list scikit“
- Output: “scikit-learn 1.2.2“
conda list scikit
This will display the version of Scikit-learn installed on your system.
Summary
Sklearn module which is also known as Scikit-learn is a Machine Learning module that is used for various machine learning purposes. If you are a machine learning developer or want to be, then you need to deal most of the time with sklearn module. In this article, we discussed how to check version o the Sklearn module on Windows on various distributions.