4
4
Installing scikit-learn
5
5
=======================
6
6
7
- .. note ::
7
+ There are different ways to install scikit-learn:
8
+
9
+ * :ref: `Install the latest official release <install_official_release >`. This
10
+ is the best approach for most users. It will provide a stable version
11
+ and pre-built packages are available for most platforms.
8
12
9
- If you wish to contribute to the project, it's recommended you
10
- :ref: `install the latest development version<install_bleeding_edge> `.
13
+ * Install the version of scikit-learn provided by your
14
+ :ref: `operating system or Python distribution <install_by_distribution >`.
15
+ This is a quick option for those who have operating systems or Python
16
+ distributions that distribute scikit-learn.
17
+ It might not provide the latest release version.
18
+
19
+ * :ref: `Building the package from source
20
+ <install_bleeding_edge>`. This is best for users who want the
21
+ latest-and-greatest features and aren't afraid of running
22
+ brand-new code. This is also needed for users who wish to contribute to the
23
+ project.
11
24
12
25
13
26
.. _install_official_release :
14
27
15
28
Installing the latest release
16
29
=============================
17
30
18
- Scikit-learn requires:
19
-
20
- - Python (>= 3.5)
21
- - NumPy (>= 1.11.0)
22
- - SciPy (>= 0.17.0)
23
- - joblib (>= 0.11)
24
-
25
- Scikit-learn plotting capabilities (i.e., functions start with "plot\_ "
26
- and classes end with "Display") require Matplotlib (>= 1.5.1). For running the
27
- examples Matplotlib >= 1.5.1 is required. A few examples require
28
- scikit-image >= 0.12.3, a few examples require pandas >= 0.18.0.
29
-
30
- .. warning ::
31
-
32
- Scikit-learn 0.20 was the last version to support Python 2.7 and Python 3.4.
33
- Scikit-learn now requires Python 3.5 or newer.
34
-
35
31
If you already have a working installation of numpy and scipy,
36
- the easiest way to install scikit-learn is using ``pip `` ::
32
+ the easiest way to install scikit-learn is using ``pip `` or ``conda ``.
33
+
34
+ With ``pip ``::
37
35
38
36
pip install -U scikit-learn
39
37
40
- or ``conda ``::
38
+ Note that in order to avoid potential conflicts with other packages it is
39
+ strongly recommended to use a virtual environment, e.g. python3 ``virtualenv ``
40
+ (see `python3 virtualenv documentation
41
+ <https://docs.python.org/3/tutorial/venv.html> `_).
42
+
43
+ If you choose to use ``conda `` (see the `instructions for downloading conda
44
+ <https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html> `_,
45
+ and `how to use conda environments
46
+ <https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html> `_)::
41
47
42
48
conda install scikit-learn
43
49
@@ -46,74 +52,116 @@ conda or pip. When using pip, please ensure that *binary wheels* are used,
46
52
and NumPy and SciPy are not recompiled from source, which can happen when using
47
53
particular configurations of operating system and hardware (such as Linux on
48
54
a Raspberry Pi).
49
- Building numpy and scipy from source can be complex (especially on Windows) and
50
- requires careful configuration to ensure that they link against an optimized
51
- implementation of linear algebra routines.
52
- Instead, use a third-party distribution as described below.
53
55
54
56
If you must install scikit-learn and its dependencies with pip, you can install
55
- it as ``scikit-learn[alldeps] ``. The most common use case for this is in a
56
- ``requirements.txt `` file used as part of an automated build process for a PaaS
57
- application or a Docker image. This option is not intended for manual
58
- installation from the command line.
57
+ it as ``scikit-learn[alldeps] ``.
58
+
59
+ Scikit-learn plotting capabilities (i.e., functions start with "plot\_ "
60
+ and classes end with "Display") require Matplotlib (>= 1.5.1). For running the
61
+ examples Matplotlib >= 1.5.1 is required. A few examples require
62
+ scikit-image >= 0.12.3, a few examples require pandas >= 0.18.0.
63
+
64
+ .. warning ::
65
+
66
+ Scikit-learn 0.20 was the last version to support Python 2.7 and Python 3.4.
67
+ Scikit-learn now requires Python 3.5 or newer.
68
+
59
69
60
70
.. note ::
61
71
62
72
For installing on PyPy, PyPy3-v5.10+, Numpy 1.14.0+, and scipy 1.1.0+
63
73
are required.
64
74
75
+ .. _install_by_distribution :
65
76
66
- For installation instructions for more distributions see
67
- :ref: `other distributions <install_by_distribution >`.
68
- For compiling the development version from source, or building the package
69
- if no distribution is available for your architecture, see the
70
- :ref: `advanced-installation `.
77
+ Third party distributions of scikit-learn
78
+ =========================================
71
79
72
- Third-party Distributions
73
- ==========================
74
- If you don't already have a python installation with numpy and scipy, we
75
- recommend to install either via your package manager or via a python bundle.
76
- These come with numpy, scipy, scikit-learn, matplotlib and many other helpful
77
- scientific and data processing libraries.
80
+ Some third-party distributions provide versions of
81
+ scikit-learn integrated with their package-management systems.
78
82
79
- Available options are:
83
+ These can make installation and upgrading much easier for users since
84
+ the integration includes the ability to automatically install
85
+ dependencies (numpy, scipy) that scikit-learn requires.
80
86
81
- Canopy and Anaconda for all supported platforms
82
- -----------------------------------------------
87
+ The following is an incomplete list of OS and python distributions
88
+ that provide their own version of scikit-learn.
83
89
84
- `Canopy
85
- <https://www.enthought.com/products/canopy> `_ and `Anaconda
86
- <https://www.anaconda.com/download> `_ both ship a recent
87
- version of scikit-learn, in addition to a large set of scientific python
88
- library for Windows, Mac OSX and Linux.
90
+ Arch Linux
91
+ ----------
89
92
90
- Anaconda offers scikit-learn as part of its free distribution.
93
+ Arch Linux's package is provided through the `official repositories
94
+ <https://www.archlinux.org/packages/?q=scikit-learn> `_ as
95
+ ``python-scikit-learn `` for Python.
96
+ It can be installed by typing the following command:
91
97
98
+ .. code-block :: none
99
+
100
+ # pacman -S python-scikit-learn
101
+
102
+
103
+ Debian/Ubuntu
104
+ -------------
105
+
106
+ The Debian/Ubuntu package is splitted in three different packages called
107
+ ``python3-sklearn `` (python modules), ``python3-sklearn-lib `` (low-level
108
+ implementations and bindings), ``python3-sklearn-doc `` (documentation).
109
+ Only the Python 3 version is available in the Debian Buster (the more recent
110
+ Debian distribution).
111
+ Packages can be installed using ``apt-get ``::
112
+
113
+ $ sudo apt-get install python3-sklearn python3-sklearn-lib
114
+ python3-sklearn-doc
115
+
116
+
117
+ Fedora
118
+ ------
119
+
120
+ The Fedora package is called ``python3-scikit-learn `` for the python 3 version,
121
+ the only one available in Fedora30.
122
+ It can be installed using ``dnf ``::
123
+
124
+ $ sudo dnf install python3-scikit-learn
92
125
93
- .. warning ::
94
126
95
- To upgrade or uninstall scikit-learn installed with Anaconda
96
- or `` conda `` you ** should not use the pip command **. Instead:
127
+ NetBSD
128
+ ------
97
129
98
- To upgrade ``scikit-learn ``::
130
+ scikit-learn is available via `pkgsrc-wip
131
+ <http://pkgsrc-wip.sourceforge.net/> `_:
99
132
100
- conda update scikit-learn
133
+ http://pkgsrc.se/wip/py-scikit_learn
101
134
102
- To uninstall ``scikit-learn ``::
103
135
104
- conda remove scikit-learn
136
+ MacPorts for Mac OSX
137
+ --------------------
105
138
106
- Upgrading with ``pip install -U scikit-learn `` or uninstalling
107
- ``pip uninstall scikit-learn `` is likely fail to properly remove files
108
- installed by the ``conda `` command.
139
+ The MacPorts package is named ``py<XY>-scikits-learn ``,
140
+ where ``XY `` denotes the Python version.
141
+ It can be installed by typing the following
142
+ command::
109
143
110
- pip upgrade and uninstall operations only work on packages installed
111
- via ``pip install ``.
144
+ sudo port install py27-scikit-learn
145
+
146
+ or::
147
+
148
+ sudo port install py36-scikit-learn
149
+
150
+
151
+ Canopy and Anaconda for all supported platforms
152
+ -----------------------------------------------
153
+
154
+ `Canopy
155
+ <https://www.enthought.com/products/canopy> `_ and `Anaconda
156
+ <https://www.anaconda.com/download> `_ both ship a recent
157
+ version of scikit-learn, in addition to a large set of scientific python
158
+ library for Windows, Mac OSX and Linux.
159
+
160
+ Anaconda offers scikit-learn as part of its free distribution.
112
161
113
162
114
163
WinPython for Windows
115
164
-----------------------
116
165
117
166
The `WinPython <https://winpython.github.io/ >`_ project distributes
118
167
scikit-learn as an additional plugin.
119
-
0 commit comments