@@ -44,11 +44,26 @@ basis to help users test bleeding edge features or bug fixes::
44
44
Building from source
45
45
=====================
46
46
47
+ In the vast majority of cases, building scikit-learn for development purposes
48
+ can be done with::
49
+
50
+ pip install cython pytest flake8
51
+
52
+ Then, in the main repository::
53
+
54
+ pip install --editable .
55
+
56
+ Please read below for details and more advanced instructions.
57
+
58
+ Dependencies
59
+ ------------
60
+
47
61
Scikit-learn requires:
48
62
49
63
- Python (>= 3.5),
50
64
- NumPy (>= 1.11),
51
- - SciPy (>= 0.17).
65
+ - SciPy (>= 0.17),
66
+ - Joblib (>= 0.11).
52
67
53
68
.. note ::
54
69
@@ -93,12 +108,12 @@ If you want to build a stable version, you can ``git checkout <VERSION>``
93
108
to get the code for that particular version, or download an zip archive of
94
109
the version from github.
95
110
96
- If you have all the build requirements installed (see below for details), you
97
- can build and install the package in the following way.
111
+ Once you have all the build requirements installed (see below for details),
112
+ you can build and install the package in the following way.
98
113
99
114
If you run the development version, it is cumbersome to reinstall the
100
115
package each time you update the sources. Therefore it's recommended that you
101
- install in editable, which allows you to edit the code in-place. This
116
+ install in editable mode , which allows you to edit the code in-place. This
102
117
builds the extension in place and creates a link to the development directory
103
118
(see `the pip docs <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs >`_)::
104
119
@@ -112,16 +127,16 @@ builds the extension in place and creates a link to the development directory
112
127
113
128
.. note ::
114
129
115
- If you decide to do an editable install you have to rerun ::
130
+ You will have to re-run ::
116
131
117
132
pip install --editable .
118
133
119
- every time the source code of a compiled extension is
120
- changed (for instance when switching branches or pulling changes from upstream).
134
+ every time the source code of a compiled extension is changed (for
135
+ instance when switching branches or pulling changes from upstream).
136
+ Compiled extensions are Cython files (ending in `.pyx ` or `.pxd `).
121
137
122
- On Unix-like systems, you can simply type ``make `` in the top-level folder to
123
- build in-place and launch all the tests. Have a look at the ``Makefile `` for
124
- additional utilities.
138
+ On Unix-like systems, you can equivalently type ``make in `` from the
139
+ top-level folder. Have a look at the ``Makefile `` for additional utilities.
125
140
126
141
Mac OSX
127
142
-------
@@ -148,62 +163,68 @@ Then you need to set the following environment variables::
148
163
149
164
Finally you can build the package using the standard command.
150
165
166
+ FreeBSD
167
+ -------
168
+
169
+ The clang compiler included in FreeBSD 12.0 and 11.2 base systems does not
170
+ include OpenMP support. You need to install the `openmp ` library from packages
171
+ (or ports)::
172
+
173
+ sudo pkg install openmp
174
+
175
+ This will install header files in ``/usr/local/include `` and libs in
176
+ ``/usr/local/lib ``. Since these directories are not searched by default, you
177
+ can set the environment variables to these locations::
178
+
179
+ export CFLAGS="$CFLAGS -I/usr/local/include"
180
+ export CXXFLAGS="$CXXFLAGS -I/usr/local/include"
181
+ export LDFLAGS="$LDFLAGS -L/usr/local/lib -lomp"
182
+ export DYLD_LIBRARY_PATH=/usr/local/lib
183
+
184
+ Finally you can build the package using the standard command.
185
+
186
+ For the upcomming FreeBSD 12.1 and 11.3 versions, OpenMP will be included in
187
+ the base system and these steps will not be necessary.
188
+
189
+
151
190
Installing build dependencies
152
191
=============================
153
192
154
193
Linux
155
194
-----
156
195
157
- Installing from source requires you to have installed the scikit-learn runtime
158
- dependencies, Python development headers and a working C/C++ compiler.
159
- Under Debian-based operating systems, which include Ubuntu::
196
+ Installing from source without conda requires you to have installed the
197
+ scikit-learn runtime dependencies, Python development headers and a working
198
+ C/C++ compiler. Under Debian-based operating systems, which include Ubuntu::
160
199
161
200
sudo apt-get install build-essential python3-dev python3-setuptools \
162
- python3-numpy python3-scipy \
163
- libatlas-dev libatlas3-base
164
-
165
- On recent Debian and Ubuntu (e.g. Ubuntu 14.04 or later) make sure that ATLAS
166
- is used to provide the implementation of the BLAS and LAPACK linear algebra
167
- routines::
201
+ python3-pip
202
+
203
+ and then::
168
204
169
- sudo update-alternatives --set libblas.so.3 \
170
- /usr/lib/atlas-base/atlas/libblas.so.3
171
- sudo update-alternatives --set liblapack.so.3 \
172
- /usr/lib/atlas-base/atlas/liblapack.so.3
205
+ pip3 install numpy scipy cython
173
206
174
207
.. note ::
175
208
176
209
In order to build the documentation and run the example code contains in
177
210
this documentation you will need matplotlib::
178
211
179
- sudo apt-get install python-matplotlib
180
-
181
- .. note ::
182
-
183
- The above installs the ATLAS implementation of BLAS
184
- (the Basic Linear Algebra Subprograms library).
185
- Ubuntu 11.10 and later, and recent (testing) versions of Debian,
186
- offer an alternative implementation called OpenBLAS.
187
-
188
- Using OpenBLAS can give speedups in some scikit-learn modules,
189
- but can freeze joblib/multiprocessing prior to OpenBLAS version 0.2.8-4,
190
- so using it is not recommended unless you know what you're doing.
212
+ pip3 install matplotlib
191
213
192
- If you do want to use OpenBLAS, then replacing ATLAS only requires a couple
193
- of commands. ATLAS has to be removed, otherwise NumPy may not work ::
214
+ When precompiled wheels are not avalaible for your architecture, you can
215
+ install the system versions ::
194
216
195
- sudo apt-get remove libatlas3gf-base libatlas-dev
196
- sudo apt-get install libopenblas-dev
197
-
198
- sudo update-alternatives --set libblas.so.3 \
199
- /usr/lib/openblas-base/libopenblas.so.0
200
- sudo update-alternatives --set liblapack.so.3 \
201
- /usr/lib/lapack/liblapack.so.3
217
+ sudo apt-get install cython3 python3-numpy python3-scipy python3-matplotlib
202
218
203
219
On Red Hat and clones (e.g. CentOS), install the dependencies using::
204
220
205
- sudo yum -y install gcc gcc-c++ numpy python-devel scipy
221
+ sudo yum -y install gcc gcc-c++ python-devel numpy scipy
222
+
223
+ .. note ::
206
224
225
+ To use a high performance BLAS library (e.g. OpenBlas) see
226
+ `scipy installation instructions
227
+ <https://docs.scipy.org/doc/scipy/reference/building/linux.html> `_.
207
228
208
229
Windows
209
230
-------
@@ -260,58 +281,3 @@ build step::
260
281
python setup.py build --compiler=my_compiler install
261
282
262
283
where ``my_compiler `` should be one of ``mingw32 `` or ``msvc ``.
263
-
264
-
265
- .. _testing :
266
-
267
- Testing
268
- =======
269
-
270
- Testing scikit-learn once installed
271
- -----------------------------------
272
-
273
- Testing requires having `pytest <https://docs.pytest.org >`_ >=\ |PytestMinVersion |\ .
274
- Some tests also require having `pandas <https://pandas.pydata.org/> ` installed.
275
- After installation, the package can be tested by executing *from outside * the
276
- source directory::
277
-
278
- $ pytest sklearn
279
-
280
- This should give you a lot of output (and some warnings) but
281
- eventually should finish with a message similar to::
282
-
283
- =========== 8304 passed, 26 skipped, 4659 warnings in 557.76 seconds ===========
284
-
285
- Otherwise, please consider posting an issue into the `GitHub issue tracker
286
- <https://github.com/scikit-learn/scikit-learn/issues> `_ or to the
287
- :ref: `mailing_lists ` including the traceback of the individual failures
288
- and errors. Please include your operating system, your version of NumPy, SciPy
289
- and scikit-learn, and how you installed scikit-learn.
290
-
291
-
292
- Testing scikit-learn from within the source folder
293
- --------------------------------------------------
294
-
295
- Scikit-learn can also be tested without having the package
296
- installed. For this you must compile the sources inplace from the
297
- source directory::
298
-
299
- python setup.py build_ext --inplace
300
-
301
- Test can now be run using pytest::
302
-
303
- pytest sklearn
304
-
305
- This is automated by the commands::
306
-
307
- make in
308
-
309
- and::
310
-
311
- make test
312
-
313
-
314
- You can also install a symlink named ``site-packages/scikit-learn.egg-link ``
315
- to the development folder of scikit-learn with::
316
-
317
- pip install --editable .
0 commit comments