How to Install Scikit-Learn on MacOS?
Last Updated :
30 Sep, 2021
In this article, we will learn how to install Scikit-Learn in Python on MacOS. The scikit-learn is a Python module for machine learning built on top of SciPy and is distributed under the 3-Clause BSD license.
Installation:
Method 1: Using pip to install Scikit-Learn Package
Follow the below steps to install the Scikit-Learn package on macOS using pip:
Step 1: Install the latest Python3 in MacOS
Step 2: Check if pip3 and python3 are correctly installed.
python3 --version
pip3 --version
Step 3: Upgrade your pip to avoid errors during installation.
pip3 install --upgrade pip
Step 4: Enter the following command to install Scikit-Learn using pip3.
pip3 install scikit-learn

Method 2: Using setup.py to install Scikit-Learn
Follow the below steps to install the Scikit-Learn package on macOS using the setup.py file:
Step 1: Download the latest source package of Scikit-Learn for python3 from here.
curl https://files.pythonhosted.org/packages/e1/4d/15c3542a17eebf61e48bd71dc55b5f3b5031f1cd0dc4aad1ff9ac9651e49/scikit-learn-1.0.tar.gz > Scikit-Learn.tar.gz
Step 2: Extract the downloaded package using the following command.
tar -xzvf Scikit-Learn.tar.gz
Step 3: Go inside the folder and Enter the following command to install the package.
Note: Install Cython via pip before installing the module via setup.py
pip3 install Cython
Note: You must have developer tools for XCode MacOS installed in your system
cd scikit-learn-1.0
python3 setup.py install

Verifying Scikit-Learn installation on macOS:
Make the following import in your python terminal to verify if the installation has been done properly:
import sklearn
If there is any error while importing the module then is not installed properly.
Similar Reads
How to Install Scikit-Learn on Linux? In this article, we are going to see how to install Scikit-Learn on Linux. Scikit-Learn is a python open source library for predictive data analysis. It is built on NumPy, SciPy, and matplotlib. It is written in Python, Cython, C, and C++ language. It is available for Linux, Unix, Windows, and Mac.
2 min read
How to install Solidity on macOS? Solidity is a programming language used for writing smart contracts for many platforms of blockchain, the most common of which is ethereum. It is an object-based programming language that runs on EVM (Ethereum Virtual Machine) which executes the smart contracts. Below are the steps to install solidi
2 min read
How to Install Tkinter on MacOS? In this article, we will learn how to install Tkinter in Python on MacOS. Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI toolkit, and is Python's de-facto standard GUI. Installation:Method 1: Using pip to install Tkinter Follow the below steps to
2 min read
How to Install Keras on MacOS? In this article, we will learn how to install Keras in Python on macOS. Keras is an open-source software library that provides a Python interface for artificial neural networks. Using pip to install Keras Package on MacOS: Follow the below steps to install the Keras package on macOS using pip: Step
1 min read
How to Install Scala on MacOS? In this article, we are going to show you how you can download and install Scala on your Mac operating system. First of all, you need to download the Java JDK which you can download here Installing Scala on MacOS: Follow the below steps to install Scala on MacOS: Step 1: After installing JDK, run th
2 min read