8000 [MRG] DOC: OS dependent installation instructions (#15156) · jeremiedbb/scikit-learn@d884add · GitHub
[go: up one dir, main page]

Skip to content

Commit d884add

Browse files
cmarmoogrisel
authored andcommitted
[MRG] DOC: OS dependent installation instructions (scikit-learn#15156)
1 parent bc3a7e1 commit d884add

File tree

2 files changed

+176
-21
lines changed

2 files changed

+176
-21
lines changed

doc/install.rst

Lines changed: 90 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,99 @@ There are different ways to install scikit-learn:
2828
Installing the latest release
2929
=============================
3030

31-
If you already have a working installation of numpy and scipy,
32-
the easiest way to install scikit-learn is using ``pip`` or ``conda``.
31+
.. This quickstart installation is a hack of the awesome
32+
https://spacy.io/usage/#quickstart page.
33+
See the original javascript implementation
34+
https://github.com/ines/quickstart
35+
36+
37+
.. raw:: html
38+
39+
<div class="install">
40+
<strong>Operating System</strong>
41+
<input type="radio" name="os" id="quickstart-win" checked>
42+
<label for="quickstart-win">Windows</label>
43+
<input type="radio" name="os" id="quickstart-mac">
44+
<label for="quickstart-mac">macOS</label>
45+
<input type="radio" name="os" id="quickstart-lin">
46+
<label for="quickstart-lin">Linux</label><br />
47+
<strong>Packager</strong>
48+
<input type="radio" name="packager" id="quickstart-pip" checked>
49+
<label for="quickstart-pip">pip</label>
50+
<input type="radio" name="packager" id="quickstart-conda">
51+
<label for="quickstart-conda">conda</label><br />
52+
<input type="checkbox" name="config" id="quickstart-venv">
53+
<label for="quickstart-venv"></label>
54+
</span>
55+
56+
.. raw:: html
57+
58+
<div>
59+
<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
60+
><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
61+
><span class="sk-expandable" data-packager="pip" data-os="linux">Install python3 and python3-pip using the package manager of the Linux Distribution.</span
62+
><span class="sk-expandable" data-packager="conda"><a href="https://docs.conda.io/projects/conda/en/latest/user-guide/install/">Install conda</a> (no administrator permission required).</span>
63+
</div>
64+
65+
Then run:
66+
67+
.. raw:: html
68+
69+
<div class="highlight"><pre><code
70+
><span class="sk-expandable" data-packager="pip" data-os="linux" data-venv="">python3 -m venv sklearn-venv</span
71+
><span class="sk-expandable" data-packager="pip" data-os="windows" data-venv="">python -m venv sklearn-venv</span
72+
><span class="sk-expandable" data-packager="pip" data-os="mac" data-venv="">python -m venv sklearn-venv</span
73+
><span class="sk-expandable" data-packager="pip" data-os="linux" data-venv="">source sklearn-venv/bin/activate</span
74+
><span class="sk-expandable" data-packager="pip" data-os="mac" data-venv="">source sklearn-venv/bin/activate</span
75+
><span class="sk-expandable" data-packager="pip" data-os="windows" data-venv="">sklearn-venv\Scripts\activate</span
76+
><span class="sk-expandable" data-packager="pip" data-venv="">pip install -U scikit-learn</span
77+
><span class="sk-expandable" data-packager="pip" data-os="mac" data-venv="no">pip install -U scikit-learn</span
78+
><span class="sk-expandable" data-packager="pip" data-os="windows" data-venv="no">pip install -U scikit-learn</span
79+
><span class="sk-expandable" data-packager="pip" data-os="linux" data-venv="no">pip3 install -U scikit-learn</span
80+
><span class="sk-expandable" data-packager="conda" data-venv="">conda create -n sklearn-env</span
81+
><span class="sk-expandable" data-packager="conda" data-venv="">conda activate sklearn-env</span
82+
><span class="sk-expandable" data-packager="conda">conda install scikit-learn </span
83+
></code></pre></div>
84+
85+
In order to check your installation you can use
86+
87+
.. raw:: html
88+
89+
<div class="highlight"><pre><code
90+
><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
91+
><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
92+
><span class="sk-expandable" data-packager="pip" data-os="linux" data-venv="no">python3 -c "import sklearn; sklearn.show_versions()"</span
93+
><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
94+
><span class="sk-expandable" data-packager="pip" data-venv="">python -m pip freeze # to see all packages installed in the active virtualenv</span
95+
><span class="sk-expandable" data-packager="pip" data-venv="">python -c "import sklearn; sklearn.show_versions()"</span
96+
><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
97+
><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
98+
><span class="sk-expandable" data-packager="pip" data-os="windows" data-venv="no">python -c "import sklearn; sklearn.show_versions()"</span
99+
><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
100+
><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
101+
><span class="sk-expandable" data-packager="pip" data-os="mac" data-venv="no">python -c "import sklearn; sklearn.show_versions()"</span
102+
><span class="sk-expandable" data-packager="conda">conda list scikit-learn # to see which scikit-learn version is installed</span
103+
><span class="sk-expandable" data-packager="conda">conda list # to see all packages installed in the active conda environment</span
104+
><span class="sk-expandable" data-packager="conda">python -c "import sklearn; sklearn.show_versions()"</span
105+
></code></pre></div>
106+
</div>
33107

34-
With ``pip``::
35-
36-
pip install -U scikit-learn
37108

38109
Note that in order to avoid potential conflicts with other packages it is
39110
strongly recommended to use a virtual environment, e.g. python3 ``virtualenv``
40111
(see `python3 virtualenv documentation
41-
<https://docs.python.org/3/tutorial/venv.html>`_).
112+
<https://docs.python.org/3/tutorial/venv.html>`_) or `conda environments
113+
<https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html>`_.
42114

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>`_)::
115+
Using an isolated environment makes possible to install a specific version of
116+
scikit-learn and its dependencies independently of any previously installed
117+
Python packages.
118+
In particular under Linux is it discouraged to install pip packages alongside
119+
the packages managed by the package manager of the distribution
120+
(apt, dnf, pacman...).
47121

48-
conda install scikit-learn
122+
Note that you should always remember to activate the environment of your choice
123+
prior to running any Python command whenever you start a new terminal session.
49124

50125
If you have not installed NumPy or SciPy yet, you can also install these using
51126
conda or pip. When using pip, please ensure that *binary wheels* are used,
@@ -97,7 +172,7 @@ It can be installed by typing the following command:
97172

98173
.. code-block:: none
99174
100-
# pacman -S python-scikit-learn
175+
$ sudo pacman -S python-scikit-learn
101176
102177
103178
Debian/Ubuntu
@@ -110,8 +185,7 @@ Only the Python 3 version is available in the Debian Buster (the more recent
110185
Debian distribution).
111186
Packages can be installed using ``apt-get``::
112187

113-
$ sudo apt-get install python3-sklearn python3-sklearn-lib
114-
python3-sklearn-doc
188+
$ sudo apt-get install python3-sklearn python3-sklearn-lib python3-sklearn-doc
115189

116190

117191
Fedora
@@ -130,7 +204,7 @@ NetBSD
130204
scikit-learn is available via `pkgsrc-wip
131205
<http://pkgsrc-wip.sourceforge.net/>`_:
132206

133-
http://pkgsrc.se/wip/py-scikit_learn
207+
http://pkgsrc.se/math/py-scikit-learn
134208

135209

136210
MacPorts for Mac OSX
@@ -141,11 +215,7 @@ where ``XY`` denotes the Python version.
141215
It can be installed by typing the following
142216
command::
143217

144-
sudo port install py27-scikit-learn
145-
146-
or::
147-
148-
sudo port install py36-scikit-learn
218+
$ sudo port install py36-scikit-learn
149219

150220

151221
Canopy and Anaconda for all supported platforms

doc/themes/scikit-learn-modern/static/css/theme.css

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ code {
3636
color: #222;
3737
background-color: #ecf0f3;
3838
border-radius: 0.2rem;
39-
padding: 0.1rem;
4039
white-space: nowrap;
4140
}
4241

@@ -1048,6 +1047,92 @@ div.testimonial span.testimonial-author p {
10481047
color: #808080;
10491048
}
10501049

1050+
div.testimonial p {
1051+
color: #1c1c1c;
1052+
}
1053+
1054+
/* Installation quickstart */
1055+
/* This quickstart installation is a hack of the awesome
1056+
https://spacy.io/usage/#quickstart page.
1057+
See the original javascript implementation
1058+
https://github.com/ines/quickstart */
1059+
1060+
/* style input radio and checkbox */
1061+
1062+
div.install > input {
1063< 10000 span class="diff-text-marker">+
-moz-appearance: none;
1064+
-webkit-appearance: none;
1065+
appearance: none;
1066+
opacity: 0;
1067+
}
1068+
1069+
/* Style the button */
1070+
div.install > label {
1071+
display: inline-block;
1072+
margin-top: 12px;
1073+
padding: 5px 11px;
1074+
background-color: #fff3cd;
1075+
border: none;
1076+
border-radius: 3px;
1077+
color: black;
1078+
}
1079+
1080+
div.install > label:hover {
1081+
cursor: pointer;
1082+
}
1083+
1084+
/* Style the button when the checkbox is checked */
1085+
div.install > input:checked + label {
1086+
background-color: #ff9c34;
1087+
color: white;
1088+
}
1089+
1090+
/* Hide expandable content by default */
1091+
.sk-expandable {
1092+
display: none;
1093+
}
1094+
1095+
div.highlight span.sk-expandable:before {
1096+
content: "$ ";
1097+
}
1098+
1099+
/* Show hidden content when the checkbox is checked */
1100+
/* for conda */
1101+
#quickstart-conda:checked ~* [data-packager="conda"] {
1102+
display: block;
1103+
}
1104+
1105+
#quickstart-conda:checked ~ label[for="quickstart-venv"]:before {
1106+
content: "Use conda environment";
1107+
}
1108+
1109+
/* for pip */
1110+
#quickstart-pip:checked ~* [data-packager="pip"] {
1111+
display: block;
1112+
}
1113+
1114+
#quickstart-pip:checked ~ label[for="quickstart-venv"]:before {
1115+
content: "Use pip virtualenv";
1116+
}
1117+
1118+
#quickstart-win:not(:checked) ~* [data-os="windows"] {
1119+
display: none;
1120+
}
1121+
#quickstart-lin:not(:checked) ~* [data-os="linux"] {
1122+
display: none;
1123+
}
1124+
#quickstart-mac:not(:checked) ~* [data-os="mac"] {
1125+
display: none;
1126+
}
1127+
1128+
#quickstart-venv:not(:checked) ~* [data-venv=""] {
1129+
display: none;
1130+
}
1131+
1132+
#quickstart-venv:checked ~* [data-venv="no"] {
1133+
display: none;
1134+
}
1135+
10511136
/* Algorithm cheet-sheet */
10521137

10531138
div.sk-page-content img.map {

0 commit comments

Comments
 (0)
0