@@ -44,11 +44,26 @@ basis to help users test bleeding edge features or bug fixes::
4444Building from source
4545=====================
4646
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+
4761Scikit-learn requires:
4862
4963- Python (>= 3.5),
5064- NumPy (>= 1.11),
51- - SciPy (>= 0.17).
65+ - SciPy (>= 0.17),
66+ - Joblib (>= 0.11).
5267
5368.. note ::
5469
@@ -93,12 +108,12 @@ If you want to build a stable version, you can ``git checkout <VERSION>``
93108to get the code for that particular version, or download an zip archive of
94109the version from github.
95110
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.
98113
99114If you run the development version, it is cumbersome to reinstall the
100115package 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
102117builds the extension in place and creates a link to the development directory
103118(see `the pip docs <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs >`_)::
104119
@@ -112,16 +127,16 @@ builds the extension in place and creates a link to the development directory
112127
113128.. note ::
114129
115- If you decide to do an editable install you have to rerun ::
130+ You will have to re-run ::
116131
117132 pip install --editable .
118133
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 `).
121137
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.
125140
126141Mac OSX
127142-------
@@ -148,62 +163,68 @@ Then you need to set the following environment variables::
148163
149164Finally you can build the package using the standard command.
150165
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+
151190Installing build dependencies
152191=============================
153192
154193Linux
155194-----
156195
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::
160199
161200 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::
168204
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
173206
174207.. note ::
175208
176209 In order to build the documentation and run the example code contains in
177210 this documentation you will need matplotlib::
178211
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
191213
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 ::
194216
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
202218
203219On Red Hat and clones (e.g. CentOS), install the dependencies using::
204220
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 ::
206224
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> `_.
207228
208229Windows
209230-------
@@ -260,58 +281,3 @@ build step::
260281 python setup.py build --compiler=my_compiler install
261282
262283where ``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