@@ -7,58 +7,98 @@ Advanced installation instructions
7
7
8
8
There are different ways to get scikit-learn installed:
9
9
10
+ * :ref: `Install an official release <install_official_release >`. This
11
+ is the best approach for most users. It will provide a stable version
12
+ and pre-build packages are available for most platforms.
13
+
10
14
* Install the version of scikit-learn provided by your
11
15
:ref: `operating system or Python distribution <install_by_distribution >`.
12
- This is the quickest option for those who have operating systems that
13
- distribute scikit-learn.
14
-
15
- * :ref: `Install an official release <install_official_release >`. This
16
- is the best approach for users who want a stable version number
17
- and aren't concerned about running a slightly older version of
18
- scikit-learn.
16
+ This is a quick option for those who have operating systems
17
+ that distribute scikit-learn. It might not provide the latest release
18
+ version.
19
19
20
- * :ref: `Install the latest development version
20
+ * :ref: `Building the package from source
21
21
<install_bleeding_edge>`. This is best for users who want the
22
22
latest-and-greatest features and aren't afraid of running
23
- brand-new code.
23
+ brand-new code. This document describes how to build from source.
24
24
25
25
.. note ::
26
26
27
27
If you wish to contribute to the project, you need to
28
28
:ref: `install the latest development version<install_bleeding_edge> `.
29
29
30
+ .. _install_bleeding_edge :
30
31
31
- .. _install_official_release :
32
-
33
- Installing an official release
34
- ==============================
32
+ Building from source
33
+ =====================
35
34
36
35
Scikit-learn requires:
37
36
38
37
- Python (>= 2.7 or >= 3.4),
39
38
- NumPy (>= 1.8.2),
40
39
- SciPy (>= 0.13.3).
41
40
41
+ Building Scikit-learn also requires
42
42
43
- Mac OSX
44
- -------
43
+ - Cython >=0.23
45
44
46
- Scikit-learn and its dependencies are all available as wheel packages for OSX::
45
+ Running tests requires
47
46
48
- pip install -U numpy scipy scikit-learn
47
+ - pytest
49
48
49
+ Some tests also require `pandas <https://pandas.pydata.org >`_.
50
50
51
- Linux
52
- -----
51
+ .. _git_repo :
52
+
53
+ Retrieving the latest code
54
+ --------------------------
55
+
56
628C
+ We use `Git <https://git-scm.com/ >`_ for version control and
57
+ `GitHub <https://github.com/ >`_ for hosting our main repository.
53
58
54
- At this time scikit-learn does not provide official binary packages for Linux
55
- so you have to build from source if you want the latest version.
56
- If you don't need the newest version, consider using your package manager to
57
- install scikit-learn. It is usually the easiest way, but might not provide the
58
- newest version.
59
+ You can check out the latest sources with the command::
60
+
61
+ git clone git://github.com/scikit-learn/scikit-learn.git
62
+
63
+ If you want to build a stable version, you can ``git checkout <VERSION> ``
64
+ to get the code for that particular version, or download an zip archive of
65
+ the version from github.
66
+
67
+ If you have all the build requirements installed (see below for details), you
68
+ can build and install the package in the following way.
69
+
70
+ If you run the development version, it is cumbersome to reinstall the
71
+ package each time you update the sources. Therefore it's recommended that you
72
+ install in editable, which allows you to edit the code in-place. This
73
+ builds the extension in place and creates a link to the development directory
74
+ (see `the pip docs <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs >`_)::
75
+
76
+ pip install --editable .
77
+
78
+ .. note ::
79
+
80
+ This is fundamentally similar to using the command ``python setup.py develop ``
81
+ (see `the setuptool docs <http://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode >`_).
82
+ It is however preferred to use pip.
83
+
84
+ .. note ::
85
+
86
+ If you decide to do an editable install you have to rerun::
87
+
88
+ pip install --editable .
89
+
90
+ every time the source code of a compiled extension is
91
+ changed (for instance when switching branches or pulling changes from upstream).
92
+
93
+ On Unix-like systems, you can simply type ``make `` in the top-level folder to
94
+ build in-place and launch all the tests. Have a look at the ``Makefile `` for
95
+ additional utilities.
59
96
60
97
Installing build dependencies
61
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98
+ =============================
99
+
100
+ Linux
101
+ -----
62
102
63
103
Installing from source requires you to have installed the scikit-learn runtime
64
104
dependencies, Python development headers and a working C/C++ compiler.
@@ -118,145 +158,9 @@ On Red Hat and clones (e.g. CentOS), install the dependencies using::
118
158
sudo yum -y install gcc gcc-c++ numpy python-devel scipy
119
159
120
160
121
- Building scikit-learn with pip
122
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123
-
124
- This is usually the fastest way to install or upgrade to the latest stable
125
- release::
126
-
127
- pip install --user --install-option="--prefix=" -U scikit-learn
128
-
129
- The ``--user `` flag asks pip to install scikit-learn in the ``$HOME/.local ``
130
- folder therefore not requiring root permission. This flag should make pip
131
- ignore any old version of scikit-learn previously installed on the system while
132
- benefiting from system packages for numpy and scipy. Those dependencies can
133
- be long and complex to build correctly from source.
134
-
135
- The ``--install-option="--prefix=" `` flag is only required if Python has a
136
- ``distutils.cfg `` configuration with a predefined ``prefix= `` entry.
137
-
138
-
139
- From source package
140
- ~~~~~~~~~~~~~~~~~~~
141
-
142
- download the source package from
143
- `pypi <https://pypi.python.org/pypi/scikit-learn >`__, unpack the sources and
144
- cd into the source directory.
145
-
146
- This packages uses distutils, which is the default way of installing
147
- python modules. The install command is::
148
-
149
- python setup.py install
150
-
151
- or alternatively (also from within the scikit-learn source folder)::
152
-
153
- pip install .
154
-
155
- .. warning ::
156
-
157
- Packages installed with the ``python setup.py install `` command cannot
158
- be uninstalled nor upgraded by ``pip `` later. To properly uninstall
159
- scikit-learn in that case it is necessary to delete the ``sklearn `` folder
160
- from your Python ``site-packages `` directory.
161
-
162
-
163
161
Windows
164
162
-------
165
163
166
- First, you need to install `numpy <http://www.numpy.org/ >`_ and `scipy
167
- <http://www.scipy.org/> `_ from their own official installers.
168
-
169
- Wheel packages (.whl files) for scikit-learn from `pypi
170
- <https://pypi.python.org/pypi/scikit-learn/> `_ can be installed with the `pip
171
- <https://pip.readthedocs.io/en/stable/installing/> `_ utility.
172
- Open a console and type the following to install or upgrade scikit-learn to the
173
- latest stable release::
174
-
175
- pip install -U scikit-learn
176
-
177
- If there are no binary packages matching your python, version you might
178
- to try to install scikit-learn and its dependencies from `christoph gohlke
179
- unofficial windows installers
180
- <https://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn> `_
181
- or from a :ref: `python distribution <install_by_distribution >` instead.
182
-
183
-
184
- .. _install_by_distribution :
185
-
186
- Third party distributions of scikit-learn
187
- =========================================
188
-
189
- Some third-party distributions are now providing versions of
190
- scikit-learn integrated with their package-management systems.
191
-
192
- These can make installation and upgrading much easier for users since
193
- the integration includes the ability to automatically install
194
- dependencies (numpy, scipy) that scikit-learn requires.
195
-
196
- The following is an incomplete list of python and os distributions
197
- that provide their own version of scikit-learn.
198
-
199
-
200
- MacPorts for Mac OSX
201
- --------------------
202
-
203
- The MacPorts package is named ``py<XY>-scikits-learn ``,
204
- where ``XY `` denotes the Python version.
205
- It can be installed by typing the following
206
- command::
207
-
208
- sudo port install py26-scikit-learn
209
-
210
- or::
211
-
212
- sudo port install py27-scikit-learn
213
-
214
-
215
- Arch Linux
216
- ----------
217
-
218
- Arch Linux's package is provided through the `official repositories
219
- <https://www.archlinux.org/packages/?q=scikit-learn> `_ as
220
- ``python-scikit-learn `` for Python 3 and ``python2-scikit-learn `` for Python 2.
221
- It can be installed by typing the following command:
222
-
223
- .. code-block :: none
224
-
225
- # pacman -S python-scikit-learn
226
-
227
- or:
228
-
229
- .. code-block :: none
230
-
231
- # pacman -S python2-scikit-learn
232
-
233
- depending on the version of Python you use.
234
-
235
-
236
- NetBSD
237
- ------
238
-
239
- scikit-learn is available via `pkgsrc-wip <http://pkgsrc-wip.sourceforge.net/ >`_:
240
-
241
- http://pkgsrc.se/wip/py-scikit_learn
242
-
243
- Fedora
244
- ------
245
-
246
- The Fedora package is called ``python-scikit-learn `` for the Python 2 version
247
- and ``python3-scikit-learn `` for the Python 3 version. Both versions can
248
- be installed using ``yum ``::
249
-
250
- $ sudo yum install python-scikit-learn
251
-
252
- or::
253
-
254
- $ sudo yum install python3-scikit-learn
255
-
256
-
257
- Building on windows
258
- -------------------
259
-
260
164
To build scikit-learn on Windows you need a working C/C++ compiler in
261
165
addition to numpy, scipy and setuptools.
262
166
@@ -358,16 +262,6 @@ build step::
358
262
where ``my_compiler `` should be one of ``mingw32 `` or ``msvc ``.
359
263
360
264
361
- .. _install_bleeding_edge :
362
-
363
- Bleeding Edge
364
- =============
365
-
366
- See section :ref: `git_repo ` on how to get the development version. Then follow
367
- the previous instructions to build from source depending on your platform.
368
- You will also require Cython >=0.23 in order to build the development version.
369
-
370
-
371
265
.. _testing :
372
266
373
267
Testing
@@ -377,8 +271,9 @@ Testing scikit-learn once installed
377
271
-----------------------------------
378
272
379
273
Testing requires having the `pytest
380
- <https://docs.pytest.org> `_ library. After
381
- installation, the package can be tested by executing *from outside * the
274
+ <https://docs.pytest.org> `_ library. Some tests also require having
275
+ `pandas <https://pandas.pydata.org/> ` installed.
276
+ After installation, the package can be tested by executing *from outside * the
382
277
source directory::
383
278
384
279
$ pytest sklearn
@@ -388,7 +283,7 @@ eventually should finish with a message similar to::
388
283
389
284
=========== 8304 passed, 26 skipped, 4659 warnings in 557.76 seconds ===========
390
285
391
- Otherwise, please consider posting an issue into the `bug tracker
286
+ Otherwise, please consider posting an issue into the `GitHub issue tracker
392
287
<https://github.com/scikit-learn/scikit-learn/issues> `_ or to the
393
288
:ref: `mailing_lists ` including the traceback of the individual failures
394
289
and errors. Please include your operating system, your version of NumPy, SciPy
0 commit comments