There are different ways to install scikit-learn:
Simply run following on terminal if you don't have pip installed on your mac. Sudo easyinstall pip. Download python 3 here: python3. Once you're done with these 2 steps, make sure to run the following to verify whether you've installed them successfully. Python3 -version pip3 -version. Improve this answer. Step 1: Update teh packege list. Sudo apt update. Step 2: Install the pip for Python 3 using the apt install command. Sudo apt install python3-pip. The above command will install all the dependencies and install pip on the ubuntu for Python 3. Step3: Verify the installation by checking the pip version.
Install the latest official release. Thisis the best approach for most users. It will provide a stable versionand pre-built packages are available for most platforms.
Install the version of scikit-learn provided by youroperating system or Python distribution.This is a quick option for those who have operating systems or Pythondistributions that distribute scikit-learn.It might not provide the latest release version.
Building the package from source. This is best for users who want thelatest-and-greatest features and aren’t afraid of runningbrand-new code. This is also needed for users who wish to contribute to theproject.
Python3 -m pip show scikit-learn # to see which version and where scikit-learn is installed python3 -m pip freeze # to see all packages installed in the active virtualenv python3 -c 'import sklearn; sklearn.showversions' python -m pip show scikit-learn # to see which version and where scikit-learn is installed python -m pip freeze # to see all packages installed in the active virtualenv. First time using Scrapy? Get Scrapy at a glance. You can also find very useful info at The Scrapy Tutorial.
Installing the latest release¶Operating System
brew install python) or by manually installing the package from https://www.python.org.Install python3 and python3-pip using the package manager of the Linux Distribution.Install conda using the Anaconda or miniconda installers or the miniforge installers (no administrator permission required for any of those).
In order to check your installation you can use
Python 3 Pip Install Mac Operating System
Note that in order to avoid potential conflicts with other packages it isstrongly recommended to use a virtual environment (venv) or a conda environment.
Using such an isolated environment makes it possible to install a specificversion of scikit-learn with pip or conda and its dependencies independently ofany previously installed Python packages. In particular under Linux is itdiscouraged to install pip packages alongside the packages managed by thepackage manager of the distribution (apt, dnf, pacman…).
Note that you should always remember to activate the environment of your choiceprior to running any Python command whenever you start a new terminal session.
If you have not installed NumPy or SciPy yet, you can also install these usingconda or pip. When using pip, please ensure that binary wheels are used,and NumPy and SciPy are not recompiled from source, which can happen when usingparticular configurations of operating system and hardware (such as Linux ona Raspberry Pi).
Scikit-learn plotting capabilities (i.e., functions start with “plot_”and classes end with “Display”) require Matplotlib. The examples requireMatplotlib and some examples require scikit-image, pandas, or seaborn. Theminimum version of Scikit-learn dependencies are listed below along with itspurpose.
benchmark, docs, examples, tests
docs, examples, tests
benchmark, docs, examples, tests
Scikit-learn 0.20 was the last version to support Python 2.7 and Python 3.4.Scikit-learn 0.21 supported Python 3.5-3.7.Scikit-learn 0.22 supported Python 3.5-3.8.Scikit-learn now requires Python 3.6 or newer.
For installing on PyPy, PyPy3-v5.10+, Numpy 1.14.0+, and scipy 1.1.0+are required.
Installing on Apple Silicon M1 hardware¶
The recently introduced
macos/arm64 platform (sometimes also known as
macos/aarch64) requires the open source community to upgrade the buildconfiguation and automation to properly support it.
At the time of writing (January 2021), the only way to get a workinginstallation of scikit-learn on this hardware is to install scikit-learn and itsdependencies from the conda-forge distribution, for instance using the miniforgeinstallers:
The following issue tracks progress on making it possible to installscikit-learn from PyPI with pip:
Third party distributions of scikit-learn¶
Some third-party distributions provide versions ofscikit-learn integrated with their package-management systems.
These can make installation and upgrading much easier for users sincethe integration includes the ability to automatically installdependencies (numpy, scipy) that scikit-learn requires.
The following is an incomplete list of OS and python distributionsthat provide their own version of scikit-learn.
Pip Install Virtualenv Python3 Mac
Arch Linux’s package is provided through the official repositories as
python-scikit-learn for Python.It can be installed by typing the following command:
The Debian/Ubuntu package is splitted in three different packages called
python3-sklearn (python modules),
python3-sklearn-lib (low-levelimplementations and bindings),
python3-sklearn-doc (documentation).Only the Python 3 version is available in the Debian Buster (the more recentDebian distribution).Packages can be installed using
The Fedora package is called
python3-scikit-learn for the python 3 version,the only one available in Fedora30.It can be installed using
scikit-learn is available via pkgsrc-wip:
MacPorts for Mac OSX¶
The MacPorts package is named
XY denotes the Python version.It can be installed by typing the followingcommand:
Anaconda and Enthought Deployment Manager for all supported platforms¶
Anaconda andEnthought Deployment Managerboth ship with scikit-learn in addition to a large set of scientificpython library for Windows, Mac OSX and Linux.
Python 3 Pip Install Mac Software
Anaconda offers scikit-learn as part of its free distribution.
Intel conda channel¶
Intel maintains a dedicated conda channel that ships scikit-learn:
This version of scikit-learn comes with alternative solvers for some commonestimators. Those solvers come from the DAAL C++ library and are optimized formulti-core Intel CPUs.
Note that those solvers are not enabled by default, please refer to thedaal4py documentationfor more details.
Compatibility with the standard scikit-learn solvers is checked by running thefull scikit-learn test suite via automated continuous integration as reportedon https://github.com/IntelPython/daal4py.
WinPython for Windows¶
The WinPython project distributesscikit-learn as an additional plugin.
Error caused by file path length limit on Windows¶
It can happen that pip fails to install packages when reaching the default pathsize limit of Windows if Python is installed in a nested location such as the
AppData folder structure under the user home directory, for instance:
In this case it is possible to lift that limit in the Windows registry byusing the
Type “regedit” in the Windows start menu to launch
Go to the
Edit the value of the
LongPathsEnabledproperty of that key and setit to 1.
Reinstall scikit-learn (ignoring the previous broken installation):
Apple’s Mac OS comes with python 2.7 installed by default. Perhaps you may want to use python 3.x.x on your machine and also use pip for package management with
python 3.x.x. The easiest way to achieve this is by:
NOTE: This tutorial does not useVirtual Environments like
pyenv to manage various
- Follow this link and download the latest
- Run the package and follow the steps to install
python3on your computer.
- Once the installation is done, on your
This will print out the version of python installed on your system. The output should be similar to:
Mac Install Python 3 Pip Windows 10
You may verify the installation directory of
python by runningthe following line on the
The prompt should print the install path for
python3. An example output is:
- Securely download the
get-pip.pyfile from this link
- From the directory where the file was downloaded to, run the following command in the
- Once the installation completes you should see the prompt print message similar to this
- Verify the installation of
pip3by running the following on the
This should return the install location of
- To install
Remember to replace
packageName with the appropriate package name for your case.
Mac Python3 Install Pip3