forked from scikit-learn/scikit-learn.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.html
702 lines (654 loc) · 39.2 KB
/
install.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta property="og:title" content="Installing scikit-learn" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://scikit-learn/stable/install.html" />
<meta property="og:site_name" content="scikit-learn" />
<meta property="og:description" content="There are different ways to install scikit-learn: Install the latest official release. This is the best approach for most users. It will provide a stable version and pre-built packages are availabl..." />
<meta property="og:image" content="https://scikit-learn.org/stable/_static/scikit-learn-logo-small.png" />
<meta property="og:image:alt" content="scikit-learn" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Installing scikit-learn — scikit-learn 1.0.2 documentation</title>
<link rel="canonical" href="http://scikit-learn.org/stable/install.html" />
<link rel="shortcut icon" href="_static/favicon.ico"/>
<link rel="stylesheet" href="_static/css/vendor/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/plot_directive.css" type="text/css" />
<link rel="stylesheet" href="_static/sg_gallery.css" type="text/css" />
<link rel="stylesheet" href="_static/sg_gallery-binder.css" type="text/css" />
<link rel="stylesheet" href="_static/sg_gallery-dataframe.css" type="text/css" />
<link rel="stylesheet" href="_static/sg_gallery-rendered-html.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
</head>
<body>
<nav id="navbar" class="sk-docs-navbar navbar navbar-expand-md navbar-light bg-light py-0">
<div class="container-fluid sk-docs-container px-0">
<a class="navbar-brand py-0" href="index.html">
<img
class="sk-brand-img"
src="_static/scikit-learn-logo-small.png"
alt="logo"/>
</a>
<button
id="sk-navbar-toggler"
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="sk-navbar-collapse collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="sk-nav-link nav-link" href="#">Install</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link" href="user_guide.html">User Guide</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link" href="modules/classes.html">API</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link" href="auto_examples/index.html">Examples</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link" target="_blank" rel="noopener noreferrer" href="https://blog.scikit-learn.org/">Community</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="getting_started.html" >Getting Started</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="tutorial/index.html" >Tutorial</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="whats_new/v1.0.html" >What's new</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="glossary.html" >Glossary</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://scikit-learn.org/dev/developers/index.html" target="_blank" rel="noopener noreferrer">Development</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="faq.html" >FAQ</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="support.html" >Support</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="related_projects.html" >Related packages</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="roadmap.html" >Roadmap</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="about.html" >About us</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://github.com/scikit-learn/scikit-learn" >GitHub</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://scikit-learn.org/dev/versions.html" >Other Versions and Download</a>
</li>
<li class="nav-item dropdown nav-more-item-dropdown">
<a class="sk-nav-link nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">More</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="sk-nav-dropdown-item dropdown-item" href="getting_started.html" >Getting Started</a>
<a class="sk-nav-dropdown-item dropdown-item" href="tutorial/index.html" >Tutorial</a>
<a class="sk-nav-dropdown-item dropdown-item" href="whats_new/v1.0.html" >What's new</a>
<a class="sk-nav-dropdown-item dropdown-item" href="glossary.html" >Glossary</a>
<a class="sk-nav-dropdown-item dropdown-item" href="https://scikit-learn.org/dev/developers/index.html" target="_blank" rel="noopener noreferrer">Development</a>
<a class="sk-nav-dropdown-item dropdown-item" href="faq.html" >FAQ</a>
<a class="sk-nav-dropdown-item dropdown-item" href="support.html" >Support</a>
<a class="sk-nav-dropdown-item dropdown-item" href="related_projects.html" >Related packages</a>
<a class="sk-nav-dropdown-item dropdown-item" href="roadmap.html" >Roadmap</a>
<a class="sk-nav-dropdown-item dropdown-item" href="about.html" >About us</a>
<a class="sk-nav-dropdown-item dropdown-item" href="https://github.com/scikit-learn/scikit-learn" >GitHub</a>
<a class="sk-nav-dropdown-item dropdown-item" href="https://scikit-learn.org/dev/versions.html" >Other Versions and Download</a>
</div>
</li>
</ul>
<div id="searchbox" role="search">
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input class="sk-search-text-input" type="text" name="q" aria-labelledby="searchlabel" />
<input class="sk-search-text-btn" type="submit" value="Go" />
</form>
</div>
</div>
</div>
</div>
</nav>
<div class="d-flex" id="sk-doc-wrapper">
<input type="checkbox" name="sk-toggle-checkbox" id="sk-toggle-checkbox">
<label id="sk-sidemenu-toggle" class="sk-btn-toggle-toc btn sk-btn-primary" for="sk-toggle-checkbox">Toggle Menu</label>
<div id="sk-sidebar-wrapper" class="border-right">
<div class="sk-sidebar-toc-wrapper">
<div class="sk-sidebar-toc-logo">
<a href="index.html">
<img
class="sk-brand-img"
src="_static/scikit-learn-logo-small.png"
alt="logo"/>
</a>
</div>
<div class="btn-group w-100 mb-2" role="group" aria-label="rellinks">
<a href="preface.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="Welcome to scikit-learn">Prev</a><a href="preface.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="Welcome to scikit-learn">Up</a>
<a href="faq.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="Frequently Asked Questions">Next</a>
</div>
<div class="alert alert-warning p-1 mb-2" role="alert">
<p class="text-center mb-0">
Please <a class="font-weight-bold" href="about.html#citing-scikit-learn"><string>cite us</string></a> if you use the software.
</p>
</div>
<div class="sk-sidebar-toc">
<ul>
<li><a class="reference internal" href="#">Installing scikit-learn</a><ul>
<li><a class="reference internal" href="#installing-the-latest-release">Installing the latest release</a></li>
<li><a class="reference internal" href="#installing-on-apple-silicon-m1-hardware">Installing on Apple Silicon M1 hardware</a></li>
<li><a class="reference internal" href="#third-party-distributions-of-scikit-learn">Third party distributions of scikit-learn</a><ul>
<li><a class="reference internal" href="#arch-linux">Arch Linux</a></li>
<li><a class="reference internal" href="#debian-ubuntu">Debian/Ubuntu</a></li>
<li><a class="reference internal" href="#fedora">Fedora</a></li>
<li><a class="reference internal" href="#netbsd">NetBSD</a></li>
<li><a class="reference internal" href="#macports-for-mac-osx">MacPorts for Mac OSX</a></li>
<li><a class="reference internal" href="#anaconda-and-enthought-deployment-manager-for-all-supported-platforms">Anaconda and Enthought Deployment Manager for all supported platforms</a></li>
<li><a class="reference internal" href="#intel-conda-channel">Intel conda channel</a></li>
<li><a class="reference internal" href="#winpython-for-windows">WinPython for Windows</a></li>
</ul>
</li>
<li><a class="reference internal" href="#troubleshooting">Troubleshooting</a><ul>
<li><a class="reference internal" href="#error-caused-by-file-path-length-limit-on-windows">Error caused by file path length limit on Windows</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div id="sk-page-content-wrapper">
<div class="sk-page-content container-fluid body px-md-3" role="main">
<section id="installing-scikit-learn">
<span id="installation-instructions"></span><h1>Installing scikit-learn<a class="headerlink" href="#installing-scikit-learn" title="Permalink to this headline">¶</a></h1>
<p>There are different ways to install scikit-learn:</p>
<blockquote>
<div><ul class="simple">
<li><p><a class="reference internal" href="#install-official-release"><span class="std std-ref">Install the latest official release</span></a>. This
is the best approach for most users. It will provide a stable version
and pre-built packages are available for most platforms.</p></li>
<li><p>Install the version of scikit-learn provided by your
<a class="reference internal" href="#install-by-distribution"><span class="std std-ref">operating system or Python distribution</span></a>.
This is a quick option for those who have operating systems or Python
distributions that distribute scikit-learn.
It might not provide the latest release version.</p></li>
<li><p><a class="reference internal" href="developers/advanced_installation.html#install-bleeding-edge"><span class="std std-ref">Building the package from source</span></a>. This is best for users who want the
latest-and-greatest features and aren’t afraid of running
brand-new code. This is also needed for users who wish to contribute to the
project.</p></li>
</ul>
</div></blockquote>
<section id="installing-the-latest-release">
<span id="install-official-release"></span><h2>Installing the latest release<a class="headerlink" href="#installing-the-latest-release" title="Permalink to this headline">¶</a></h2>
<div class="install">
<strong>Operating System</strong>
<input type="radio" name="os" id="quickstart-win" checked>
<label for="quickstart-win">Windows</label>
<input type="radio" name="os" id="quickstart-mac">
<label for="quickstart-mac">macOS</label>
<input type="radio" name="os" id="quickstart-lin">
<label for="quickstart-lin">Linux</label><br />
<strong>Packager</strong>
<input type="radio" name="packager" id="quickstart-pip" checked>
<label for="quickstart-pip">pip</label>
<input type="radio" name="packager" id="quickstart-conda">
<label for="quickstart-conda">conda</label><br />
<input type="checkbox" name="config" id="quickstart-venv">
<label for="quickstart-venv"></label>
</span><div>
<span class="sk-expandable" data-packager="pip" data-os="windows">Install the 64bit version of Python 3, for instance from <a href="https://www.python.org/">https://www.python.org</a>.</span
><span class="sk-expandable" data-packager="pip" data-os="mac">Install Python 3 using <a href="https://brew.sh/">homebrew</a> (<code>brew install python</code>) or by manually installing the package from <a href="https://www.python.org">https://www.python.org</a>.</span
><span class="sk-expandable" data-packager="pip" data-os="linux">Install python3 and python3-pip using the package manager of the Linux Distribution.</span
><span class="sk-expandable" data-packager="conda"
>Install conda using the <a href="https://docs.conda.io/projects/conda/en/latest/user-guide/install/">Anaconda or miniconda</a>
installers or the <a href="https://https://github.com/conda-forge/miniforge#miniforge">miniforge</a> installers
(no administrator permission required for any of those).</span>
</div><p>Then run:</p>
<div class="highlight"><pre><code
><span class="sk-expandable" data-packager="pip" data-os="linux" data-venv="">python3 -m venv sklearn-venv</span
><span class="sk-expandable" data-packager="pip" data-os="windows" data-venv="">python -m venv sklearn-venv</span
><span class="sk-expandable" data-packager="pip" data-os="mac" data-venv="">python -m venv sklearn-venv</span
><span class="sk-expandable" data-packager="pip" data-os="linux" data-venv="">source sklearn-venv/bin/activate</span
><span class="sk-expandable" data-packager="pip" data-os="mac" data-venv="">source sklearn-venv/bin/activate</span
><span class="sk-expandable" data-packager="pip" data-os="windows" data-venv="">sklearn-venv\Scripts\activate</span
><span class="sk-expandable" data-packager="pip" data-venv="">pip install -U scikit-learn</span
><span class="sk-expandable" data-packager="pip" data-os="mac" data-venv="no">pip install -U scikit-learn</span
><span class="sk-expandable" data-packager="pip" data-os="windows" data-venv="no">pip install -U scikit-learn</span
><span class="sk-expandable" data-packager="pip" data-os="linux" data-venv="no">pip3 install -U scikit-learn</span
><span class="sk-expandable" data-packager="conda" data-venv="">conda create -n sklearn-env -c conda-forge scikit-learn</span
><span class="sk-expandable" data-packager="conda" data-venv="">conda activate sklearn-env</span
></code></pre></div><p>In order to check your installation you can use</p>
<div class="highlight"><pre><code
><span class="sk-expandable" data-packager="pip" data-os="linux" data-venv="no">python3 -m pip show scikit-learn # to see which version and where scikit-learn is installed</span
><span class="sk-expandable" data-packager="pip" data-os="linux" data-venv="no">python3 -m pip freeze # to see all packages installed in the active virtualenv</span
><span class="sk-expandable" data-packager="pip" data-os="linux" data-venv="no">python3 -c "import sklearn; sklearn.show_versions()"</span
><span class="sk-expandable" data-packager="pip" data-venv="">python -m pip show scikit-learn # to see which version and where scikit-learn is installed</span
><span class="sk-expandable" data-packager="pip" data-venv="">python -m pip freeze # to see all packages installed in the active virtualenv</span
><span class="sk-expandable" data-packager="pip" data-venv="">python -c "import sklearn; sklearn.show_versions()"</span
><span class="sk-expandable" data-packager="pip" data-os="windows" data-venv="no">python -m pip show scikit-learn # to see which version and where scikit-learn is installed</span
><span class="sk-expandable" data-packager="pip" data-os="windows" data-venv="no">python -m pip freeze # to see all packages installed in the active virtualenv</span
><span class="sk-expandable" data-packager="pip" data-os="windows" data-venv="no">python -c "import sklearn; sklearn.show_versions()"</span
><span class="sk-expandable" data-packager="pip" data-os="mac" data-venv="no">python -m pip show scikit-learn # to see which version and where scikit-learn is installed</span
><span class="sk-expandable" data-packager="pip" data-os="mac" data-venv="no">python -m pip freeze # to see all packages installed in the active virtualenv</span
><span class="sk-expandable" data-packager="pip" data-os="mac" data-venv="no">python -c "import sklearn; sklearn.show_versions()"</span
><span class="sk-expandable" data-packager="conda">conda list scikit-learn # to see which scikit-learn version is installed</span
><span class="sk-expandable" data-packager="conda">conda list # to see all packages installed in the active conda environment</span
><span class="sk-expandable" data-packager="conda">python -c "import sklearn; sklearn.show_versions()"</span
></code></pre></div>
</div><p>Note that in order to avoid potential conflicts with other packages it is
strongly recommended to use a <a class="reference external" href="https://docs.python.org/3/tutorial/venv.html">virtual environment (venv)</a> or a <a class="reference external" href="https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html">conda environment</a>.</p>
<p>Using such an isolated environment makes it possible to install a specific
version of scikit-learn with pip or conda and its dependencies independently of
any previously installed Python packages. In particular under Linux is it
discouraged to install pip packages alongside the packages managed by the
package manager of the distribution (apt, dnf, pacman…).</p>
<p>Note that you should always remember to activate the environment of your choice
prior to running any Python command whenever you start a new terminal session.</p>
<p>If you have not installed NumPy or SciPy yet, you can also install these using
conda or pip. When using pip, please ensure that <em>binary wheels</em> are used,
and NumPy and SciPy are not recompiled from source, which can happen when using
particular configurations of operating system and hardware (such as Linux on
a Raspberry Pi).</p>
<p>Scikit-learn plotting capabilities (i.e., functions start with “plot_”
and classes end with “Display”) require Matplotlib. The examples require
Matplotlib and some examples require scikit-image, pandas, or seaborn. The
minimum version of Scikit-learn dependencies are listed below along with its
purpose.</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 29%" />
<col style="width: 24%" />
<col style="width: 46%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Dependency</p></th>
<th class="head"><p>Minimum Version</p></th>
<th class="head"><p>Purpose</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>numpy</p></td>
<td><p>1.14.6</p></td>
<td><p>build, install</p></td>
</tr>
<tr class="row-odd"><td><p>scipy</p></td>
<td><p>1.1.0</p></td>
<td><p>build, install</p></td>
</tr>
<tr class="row-even"><td><p>joblib</p></td>
<td><p>0.11</p></td>
<td><p>install</p></td>
</tr>
<tr class="row-odd"><td><p>threadpoolctl</p></td>
<td><p>2.0.0</p></td>
<td><p>install</p></td>
</tr>
<tr class="row-even"><td><p>cython</p></td>
<td><p>0.29.24</p></td>
<td><p>build</p></td>
</tr>
<tr class="row-odd"><td><p>matplotlib</p></td>
<td><p>2.2.3</p></td>
<td><p>benchmark, docs, examples, tests</p></td>
</tr>
<tr class="row-even"><td><p>scikit-image</p></td>
<td><p>0.14.5</p></td>
<td><p>docs, examples, tests</p></td>
</tr>
<tr class="row-odd"><td><p>pandas</p></td>
<td><p>0.25.0</p></td>
<td><p>benchmark, docs, examples, tests</p></td>
</tr>
<tr class="row-even"><td><p>seaborn</p></td>
<td><p>0.9.0</p></td>
<td><p>docs, examples</p></td>
</tr>
<tr class="row-odd"><td><p>memory_profiler</p></td>
<td><p>0.57.0</p></td>
<td><p>benchmark, docs</p></td>
</tr>
<tr class="row-even"><td><p>pytest</p></td>
<td><p>5.0.1</p></td>
<td><p>tests</p></td>
</tr>
<tr class="row-odd"><td><p>pytest-cov</p></td>
<td><p>2.9.0</p></td>
<td><p>tests</p></td>
</tr>
<tr class="row-even"><td><p>flake8</p></td>
<td><p>3.8.2</p></td>
<td><p>tests</p></td>
</tr>
<tr class="row-odd"><td><p>black</p></td>
<td><p>21.6b0</p></td>
<td><p>tests</p></td>
</tr>
<tr class="row-even"><td><p>mypy</p></td>
<td><p>0.770</p></td>
<td><p>tests</p></td>
</tr>
<tr class="row-odd"><td><p>pyamg</p></td>
<td><p>4.0.0</p></td>
<td><p>tests</p></td>
</tr>
<tr class="row-even"><td><p>sphinx</p></td>
<td><p>4.0.1</p></td>
<td><p>docs</p></td>
</tr>
<tr class="row-odd"><td><p>sphinx-gallery</p></td>
<td><p>0.7.0</p></td>
<td><p>docs</p></td>
</tr>
<tr class="row-even"><td><p>numpydoc</p></td>
<td><p>1.0.0</p></td>
<td><p>docs</p></td>
</tr>
<tr class="row-odd"><td><p>Pillow</p></td>
<td><p>7.1.2</p></td>
<td><p>docs</p></td>
</tr>
<tr class="row-even"><td><p>sphinx-prompt</p></td>
<td><p>1.3.0</p></td>
<td><p>docs</p></td>
</tr>
<tr class="row-odd"><td><p>sphinxext-opengraph</p></td>
<td><p>0.4.2</p></td>
<td><p>docs</p></td>
</tr>
</tbody>
</table>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>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 0.23 - 0.24 require Python 3.6 or newer.
Scikit-learn 1.0 and later requires Python 3.7 or newer.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>For installing on PyPy, PyPy3-v5.10+, Numpy 1.14.0+, and scipy 1.1.0+
are required.</p>
</div>
</section>
<section id="installing-on-apple-silicon-m1-hardware">
<span id="install-on-apple-silicon-m1"></span><h2>Installing on Apple Silicon M1 hardware<a class="headerlink" href="#installing-on-apple-silicon-m1-hardware" title="Permalink to this headline">¶</a></h2>
<p>The recently introduced <code class="docutils literal notranslate"><span class="pre">macos/arm64</span></code> platform (sometimes also known as
<code class="docutils literal notranslate"><span class="pre">macos/aarch64</span></code>) requires the open source community to upgrade the build
configuration and automation to properly support it.</p>
<p>At the time of writing (January 2021), the only way to get a working
installation of scikit-learn on this hardware is to install scikit-learn and its
dependencies from the conda-forge distribution, for instance using the miniforge
installers:</p>
<p><a class="reference external" href="https://github.com/conda-forge/miniforge">https://github.com/conda-forge/miniforge</a></p>
<p>The following issue tracks progress on making it possible to install
scikit-learn from PyPI with pip:</p>
<p><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/issues/19137">https://github.com/scikit-learn/scikit-learn/issues/19137</a></p>
</section>
<section id="third-party-distributions-of-scikit-learn">
<span id="install-by-distribution"></span><h2>Third party distributions of scikit-learn<a class="headerlink" href="#third-party-distributions-of-scikit-learn" title="Permalink to this headline">¶</a></h2>
<p>Some third-party distributions provide versions of
scikit-learn integrated with their package-management systems.</p>
<p>These can make installation and upgrading much easier for users since
the integration includes the ability to automatically install
dependencies (numpy, scipy) that scikit-learn requires.</p>
<p>The following is an incomplete list of OS and python distributions
that provide their own version of scikit-learn.</p>
<section id="arch-linux">
<h3>Arch Linux<a class="headerlink" href="#arch-linux" title="Permalink to this headline">¶</a></h3>
<p>Arch Linux’s package is provided through the <a class="reference external" href="https://www.archlinux.org/packages/?q=scikit-learn">official repositories</a> as
<code class="docutils literal notranslate"><span class="pre">python-scikit-learn</span></code> for Python.
It can be installed by typing the following command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
content: "$ ";
}
</style><span class="prompt1">sudo pacman -S python-scikit-learn</span>
</pre></div></div></section>
<section id="debian-ubuntu">
<h3>Debian/Ubuntu<a class="headerlink" href="#debian-ubuntu" title="Permalink to this headline">¶</a></h3>
<p>The Debian/Ubuntu package is split in three different packages called
<code class="docutils literal notranslate"><span class="pre">python3-sklearn</span></code> (python modules), <code class="docutils literal notranslate"><span class="pre">python3-sklearn-lib</span></code> (low-level
implementations and bindings), <code class="docutils literal notranslate"><span class="pre">python3-sklearn-doc</span></code> (documentation).
Only the Python 3 version is available in the Debian Buster (the more recent
Debian distribution).
Packages can be installed using <code class="docutils literal notranslate"><span class="pre">apt-get</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">sudo apt-get install python3-sklearn python3-sklearn-lib python3-sklearn-doc</span>
</pre></div></div></section>
<section id="fedora">
<h3>Fedora<a class="headerlink" href="#fedora" title="Permalink to this headline">¶</a></h3>
<p>The Fedora package is called <code class="docutils literal notranslate"><span class="pre">python3-scikit-learn</span></code> for the python 3 version,
the only one available in Fedora30.
It can be installed using <code class="docutils literal notranslate"><span class="pre">dnf</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">sudo dnf install python3-scikit-learn</span>
</pre></div></div></section>
<section id="netbsd">
<h3>NetBSD<a class="headerlink" href="#netbsd" title="Permalink to this headline">¶</a></h3>
<p>scikit-learn is available via <a class="reference external" href="http://pkgsrc-wip.sourceforge.net/">pkgsrc-wip</a>:</p>
<blockquote>
<div><p><a class="reference external" href="http://pkgsrc.se/math/py-scikit-learn">http://pkgsrc.se/math/py-scikit-learn</a></p>
</div></blockquote>
</section>
<section id="macports-for-mac-osx">
<h3>MacPorts for Mac OSX<a class="headerlink" href="#macports-for-mac-osx" title="Permalink to this headline">¶</a></h3>
<p>The MacPorts package is named <code class="docutils literal notranslate"><span class="pre">py<XY>-scikits-learn</span></code>,
where <code class="docutils literal notranslate"><span class="pre">XY</span></code> denotes the Python version.
It can be installed by typing the following
command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">sudo port install py39-scikit-learn</span>
</pre></div></div></section>
<section id="anaconda-and-enthought-deployment-manager-for-all-supported-platforms">
<h3>Anaconda and Enthought Deployment Manager for all supported platforms<a class="headerlink" href="#anaconda-and-enthought-deployment-manager-for-all-supported-platforms" title="Permalink to this headline">¶</a></h3>
<p><a class="reference external" href="https://www.anaconda.com/download">Anaconda</a> and
<a class="reference external" href="https://assets.enthought.com/downloads/">Enthought Deployment Manager</a>
both ship with scikit-learn in addition to a large set of scientific
python library for Windows, Mac OSX and Linux.</p>
<p>Anaconda offers scikit-learn as part of its free distribution.</p>
</section>
<section id="intel-conda-channel">
<h3>Intel conda channel<a class="headerlink" href="#intel-conda-channel" title="Permalink to this headline">¶</a></h3>
<p>Intel maintains a dedicated conda channel that ships scikit-learn:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">conda install -c intel scikit-learn</span>
</pre></div></div><p>This version of scikit-learn comes with alternative solvers for some common
estimators. Those solvers come from the DAAL C++ library and are optimized for
multi-core Intel CPUs.</p>
<p>Note that those solvers are not enabled by default, please refer to the
<a class="reference external" href="https://intelpython.github.io/daal4py/sklearn.html">daal4py</a> documentation
for more details.</p>
<p>Compatibility with the standard scikit-learn solvers is checked by running the
full scikit-learn test suite via automated continuous integration as reported
on <a class="reference external" href="https://github.com/IntelPython/daal4py">https://github.com/IntelPython/daal4py</a>.</p>
</section>
<section id="winpython-for-windows">
<h3>WinPython for Windows<a class="headerlink" href="#winpython-for-windows" title="Permalink to this headline">¶</a></h3>
<p>The <a class="reference external" href="https://winpython.github.io/">WinPython</a> project distributes
scikit-learn as an additional plugin.</p>
</section>
</section>
<section id="troubleshooting">
<h2>Troubleshooting<a class="headerlink" href="#troubleshooting" title="Permalink to this headline">¶</a></h2>
<section id="error-caused-by-file-path-length-limit-on-windows">
<span id="windows-longpath"></span><h3>Error caused by file path length limit on Windows<a class="headerlink" href="#error-caused-by-file-path-length-limit-on-windows" title="Permalink to this headline">¶</a></h3>
<p>It can happen that pip fails to install packages when reaching the default path
size limit of Windows if Python is installed in a nested location such as the
<code class="docutils literal notranslate"><span class="pre">AppData</span></code> folder structure under the user home directory, for instance:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">C</span><span class="p">:</span>\<span class="n">Users</span>\<span class="n">username</span><span class="o">></span><span class="n">C</span><span class="p">:</span>\<span class="n">Users</span>\<span class="n">username</span>\<span class="n">AppData</span>\<span class="n">Local</span>\<span class="n">Microsoft</span>\<span class="n">WindowsApps</span>\<span class="n">python</span><span class="o">.</span><span class="n">exe</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="n">scikit</span><span class="o">-</span><span class="n">learn</span>
<span class="n">Collecting</span> <span class="n">scikit</span><span class="o">-</span><span class="n">learn</span>
<span class="o">...</span>
<span class="n">Installing</span> <span class="n">collected</span> <span class="n">packages</span><span class="p">:</span> <span class="n">scikit</span><span class="o">-</span><span class="n">learn</span>
<span class="n">ERROR</span><span class="p">:</span> <span class="n">Could</span> <span class="ow">not</span> <span class="n">install</span> <span class="n">packages</span> <span class="n">due</span> <span class="n">to</span> <span class="n">an</span> <span class="ne">EnvironmentError</span><span class="p">:</span> <span class="p">[</span><span class="n">Errno</span> <span class="mi">2</span><span class="p">]</span> <span class="n">No</span> <span class="n">such</span> <span class="n">file</span> <span class="ow">or</span> <span class="n">directory</span><span class="p">:</span> <span class="s1">'C:</span><span class="se">\\</span><span class="s1">Users</span><span class="se">\\</span><span class="s1">username</span><span class="se">\\</span><span class="s1">AppData</span><span class="se">\\</span><span class="s1">Local</span><span class="se">\\</span><span class="s1">Packages</span><span class="se">\\</span><span class="s1">PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0</span><span class="se">\\</span><span class="s1">LocalCache</span><span class="se">\\</span><span class="s1">local-packages</span><span class="se">\\</span><span class="s1">Python37</span><span class="se">\\</span><span class="s1">site-packages</span><span class="se">\\</span><span class="s1">sklearn</span><span class="se">\\</span><span class="s1">datasets</span><span class="se">\\</span><span class="s1">tests</span><span class="se">\\</span><span class="s1">data</span><span class="se">\\</span><span class="s1">openml</span><span class="se">\\</span><span class="s1">292</span><span class="se">\\</span><span class="s1">api-v1-json-data-list-data_name-australian-limit-2-data_version-1-status-deactivated.json.gz'</span>
</pre></div>
</div>
<p>In this case it is possible to lift that limit in the Windows registry by
using the <code class="docutils literal notranslate"><span class="pre">regedit</span></code> tool:</p>
<ol class="arabic simple">
<li><p>Type “regedit” in the Windows start menu to launch <code class="docutils literal notranslate"><span class="pre">regedit</span></code>.</p></li>
<li><p>Go to the
<code class="docutils literal notranslate"><span class="pre">Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem</span></code>
key.</p></li>
<li><p>Edit the value of the <code class="docutils literal notranslate"><span class="pre">LongPathsEnabled</span></code> property of that key and set
it to 1.</p></li>
<li><p>Reinstall scikit-learn (ignoring the previous broken installation):</p></li>
</ol>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1"><span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="n">exists</span><span class="o">-</span><span class="n">action</span><span class="o">=</span><span class="n">i</span> <span class="n">scikit</span><span class="o">-</span><span class="n">learn</span></span>
</pre></div></div></section>
</section>
</section>
</div>
<div class="container">
<footer class="sk-content-footer">
© 2007 - 2022, scikit-learn developers (BSD License).
<a href="_sources/install.rst.txt" rel="nofollow">Show this page source</a>
</footer>
</div>
</div>
</div>
<script src="_static/js/vendor/bootstrap.min.js"></script>
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-22606712-2', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<script>
$(document).ready(function() {
/* Add a [>>>] button on the top-right corner of code samples to hide
* the >>> and ... prompts and the output and thus make the code
* copyable. */
var div = $('.highlight-python .highlight,' +
'.highlight-python3 .highlight,' +
'.highlight-pycon .highlight,' +
'.highlight-default .highlight')
var pre = div.find('pre');
// get the styles from the current theme
pre.parent().parent().css('position', 'relative');
var hide_text = 'Hide prompts and outputs';
var show_text = 'Show prompts and outputs';
// create and add the button to all the code blocks that contain >>>
div.each(function(index) {
var jthis = $(this);
if (jthis.find('.gp').length > 0) {
var button = $('<span class="copybutton">>>></span>');
button.attr('title', hide_text);
button.data('hidden', 'false');
jthis.prepend(button);
}
// tracebacks (.gt) contain bare text elements that need to be
// wrapped in a span to work with .nextUntil() (see later)
jthis.find('pre:has(.gt)').contents().filter(function() {
return ((this.nodeType == 3) && (this.data.trim().length > 0));
}).wrap('<span>');
});
// define the behavior of the button when it's clicked
$('.copybutton').click(function(e){
e.preventDefault();
var button = $(this);
if (button.data('hidden') === 'false') {
// hide the code output
button.parent().find('.go, .gp, .gt').hide();
button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'hidden');
button.css('text-decoration', 'line-through');
button.attr('title', show_text);
button.data('hidden', 'true');
} else {
// show the code output
button.parent().find('.go, .gp, .gt').show();
button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'visible');
button.css('text-decoration', 'none');
button.attr('title', hide_text);
button.data('hidden', 'false');
}
});
/*** Add permalink buttons next to glossary terms ***/
$('dl.glossary > dt[id]').append(function() {
return ('<a class="headerlink" href="#' +
this.getAttribute('id') +
'" title="Permalink to this term">¶</a>');
});
/*** Hide navbar when scrolling down ***/
// Returns true when headerlink target matches hash in url
(function() {
hashTargetOnTop = function() {
var hash = window.location.hash;
if ( hash.length < 2 ) { return false; }
var target = document.getElementById( hash.slice(1) );
if ( target === null ) { return false; }
var top = target.getBoundingClientRect().top;
return (top < 2) && (top > -2);
};
// Hide navbar on load if hash target is on top
var navBar = document.getElementById("navbar");
var navBarToggler = document.getElementById("sk-navbar-toggler");
var navBarHeightHidden = "-" + navBar.getBoundingClientRect().height + "px";
var $window = $(window);
hideNavBar = function() {
navBar.style.top = navBarHeightHidden;
};
showNavBar = function() {
navBar.style.top = "0";
}
if (hashTargetOnTop()) {
hideNavBar()
}
var prevScrollpos = window.pageYOffset;
hideOnScroll = function(lastScrollTop) {
if (($window.width() < 768) && (navBarToggler.getAttribute("aria-expanded") === 'true')) {
return;
}
if (lastScrollTop > 2 && (prevScrollpos <= lastScrollTop) || hashTargetOnTop()){
hideNavBar()
} else {
showNavBar()
}
prevScrollpos = lastScrollTop;
};
/*** high performance scroll event listener***/
var raf = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.msRequestAnimationFrame ||
window.oRequestAnimationFrame;
var lastScrollTop = $window.scrollTop();
if (raf) {
loop();
}
function loop() {
var scrollTop = $window.scrollTop();
if (lastScrollTop === scrollTop) {
raf(loop);
return;
} else {
lastScrollTop = scrollTop;
hideOnScroll(lastScrollTop);
raf(loop);
}
}
})();
});
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
<script src="https://scikit-learn.org/versionwarning.js"></script>
</body>
</html>