@@ -26,7 +26,7 @@ Installing a nightly build is the quickest way to:
2626
2727- check whether a bug you encountered has been fixed since the last release.
2828
29- ::
29+ .. prompt :: bash $
3030
3131 pip install --pre --extra-index https://pypi.anaconda.org/scipy-wheels-nightly/simple scikit-learn
3232
@@ -43,7 +43,9 @@ feature, code or documentation improvement).
4343
4444#. Use `Git <https://git-scm.com/ >`_ to check out the latest source from the
4545 `scikit-learn repository <https://github.com/scikit-learn/scikit-learn >`_ on
46- Github.::
46+ Github.:
47+
48+ .. prompt :: bash $
4749
4850 git clone git://github.com/scikit-learn/scikit-learn.git # add --depth 1 if your connection is slow
4951 cd scikit-learn
@@ -58,13 +60,17 @@ feature, code or documentation improvement).
5860#. Optional (but recommended): create and activate a dedicated virtualenv _
5961 or `conda environment `_.
6062
61- #. Install Cython _ and build the project with pip in :ref: `editable_mode `::
63+ #. Install Cython _ and build the project with pip in :ref: `editable_mode `:
64+
65+ .. prompt :: bash $
6266
6367 pip install cython
6468 pip install --verbose --no-build-isolation --editable .
6569
6670#. Check that the installed scikit-learn has a version number ending with
67- `.dev0 `::
71+ `.dev0 `:
72+
73+ .. prompt :: bash $
6874
6975 python -c "import sklearn; sklearn.show_versions()"
7076
@@ -194,11 +200,15 @@ First, install `Build Tools for Visual Studio 2019
194200Secondly, find out if you are running 64-bit or 32-bit Python. The building
195201command depends on the architecture of the Python interpreter. You can check
196202the architecture by running the following in ``cmd `` or ``powershell ``
197- console::
203+ console:
204+
205+ .. prompt :: bash $
198206
199207 python -c "import struct; print(struct.calcsize('P') * 8)"
200208
201- For 64-bit Python, configure the build environment with::
209+ For 64-bit Python, configure the build environment with:
210+
211+ .. prompt :: bash $
202212
203213 SET DISTUTILS_USE_SDK=1
204214 "C:\P rogram Files (x86)\M icrosoft Visual Studio\2 019\B uildTools\V C\A uxiliary\B uild\v cvarsall.bat" x64
@@ -209,7 +219,9 @@ Please be aware that the path above might be different from user to user. The
209219aim is to point to the "vcvarsall.bat" file that will set the necessary
210220environment variables in the current command prompt.
211221
212- Finally, build scikit-learn from this command prompt::
222+ Finally, build scikit-learn from this command prompt:
223+
224+ .. prompt :: bash $
213225
214226 pip install --verbose --no-build-isolation --editable .
215227
@@ -233,12 +245,16 @@ If you use the conda package manager (version >= 4.7), you can install the
233245``compilers `` meta-package from the conda-forge channel, which provides
234246OpenMP-enabled C/C++ compilers based on the llvm toolchain.
235247
236- First install the macOS command line tools::
248+ First install the macOS command line tools:
249+
250+ .. prompt :: bash $
237251
238252 xcode-select --install
239253
240254It is recommended to use a dedicated `conda environment `_ to build
241- scikit-learn from source::
255+ scikit-learn from source:
256+
257+ .. prompt :: bash $
242258
243259 conda create -n sklearn-dev -c conda-forge python numpy scipy cython \
244260 joblib threadpoolctl pytest "compilers>=1.0.4,!=1.1.0" llvm-openmp
@@ -254,14 +270,18 @@ scikit-learn from source::
254270 problems for this setup.
255271
256272You can check that the custom compilers are properly installed from conda
257- forge using the following command::
273+ forge using the following command:
258274
259- conda list
275+ .. prompt :: bash $
276+
277+ conda list
260278
261279which should include ``compilers `` and ``llvm-openmp ``.
262280
263281The compilers meta-package will automatically set custom environment
264- variables::
282+ variables:
283+
284+ .. prompt :: bash $
265285
266286 echo $CC
267287 echo $CXX
@@ -283,17 +303,23 @@ macOS compilers from Homebrew
283303Another solution is to enable OpenMP support for the clang compiler shipped
284304by default on macOS.
285305
286- First install the macOS command line tools::
306+ First install the macOS command line tools:
307+
308+ .. prompt :: bash $
287309
288310 xcode-select --install
289311
290312Install the Homebrew _ package manager for macOS.
291313
292- Install the LLVM OpenMP library::
314+ Install the LLVM OpenMP library:
315+
316+ .. prompt :: bash $
293317
294318 brew install libomp
295319
296- Set the following environment variables::
320+ Set the following environment variables:
321+
322+ .. prompt :: bash $
297323
298324 export CC=/usr/bin/clang
299325 export CXX=/usr/bin/clang++
@@ -303,7 +329,9 @@ Set the following environment variables::
303329 export LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/local/opt/libomp/lib -L/usr/local/opt/libomp/lib -lomp"
304330
305331Finally, build scikit-learn in verbose mode (to check for the presence of the
306- ``-fopenmp `` flag in the compiler commands)::
332+ ``-fopenmp `` flag in the compiler commands):
333+
334+ .. prompt :: bash $
307335
308336 make clean
309337 pip install --verbose --no-build-isolation --editable .
@@ -321,11 +349,15 @@ installed the scikit-learn Python development headers and a working C/C++
321349compiler with OpenMP support (typically the GCC toolchain).
322350
323351Install build dependencies for Debian-based operating systems, e.g.
324- Ubuntu::
352+ Ubuntu:
353+
354+ .. prompt :: bash $
325355
326356 sudo apt-get install build-essential python3-dev python3-pip
327357
328- then proceed as usual::
358+ then proceed as usual:
359+
360+ .. prompt :: bash $
329361
330362 pip3 install cython
331363 pip3 install --verbose --editable .
@@ -339,19 +371,25 @@ using an isolated environment, ``pip3`` should be replaced by ``pip`` in the
339371above commands.
340372
341373When precompiled wheels of the runtime dependencies are not avalaible for your
342- architecture (e.g. ARM), you can install the system versions::
374+ architecture (e.g. ARM), you can install the system versions:
375+
376+ .. prompt :: bash $
343377
344378 sudo apt-get install cython3 python3-numpy python3-scipy
345379
346- On Red Hat and clones (e.g. CentOS), install the dependencies using::
380+ On Red Hat and clones (e.g. CentOS), install the dependencies using:
381+
382+ .. prompt :: bash $
347383
348384 sudo yum -y install gcc gcc-c++ python3-devel numpy scipy
349385
350386Linux compilers from conda-forge
351387~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
352388
353389Alternatively, install a recent version of the GNU C Compiler toolchain (GCC)
354- in the user folder using conda::
390+ in the user folder using conda:
391+
392+ .. prompt :: bash $
355393
356394 conda create -n sklearn-dev -c conda-forge python numpy scipy cython \
357395 joblib threadpoolctl pytest compilers
@@ -365,19 +403,25 @@ FreeBSD
365403
366404The clang compiler included in FreeBSD 12.0 and 11.2 base systems does not
367405include OpenMP support. You need to install the `openmp ` library from packages
368- (or ports)::
406+ (or ports):
407+
408+ .. prompt :: bash $
369409
370410 sudo pkg install openmp
371411
372412This will install header files in ``/usr/local/include `` and libs in
373413``/usr/local/lib ``. Since these directories are not searched by default, you
374- can set the environment variables to these locations::
414+ can set the environment variables to these locations:
415+
416+ .. prompt :: bash $
375417
376418 export CFLAGS="$CFLAGS -I/usr/local/include"
377419 export CXXFLAGS="$CXXFLAGS -I/usr/local/include"
378420 export LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lomp"
379421
380- Finally, build the package using the standard command::
422+ Finally, build the package using the standard command:
423+
424+ .. prompt :: bash $
381425
382426 pip install --verbose --no-build-isolation --editable .
383427
@@ -393,22 +437,30 @@ the base system and these steps will not be necessary.
393437Alternative compilers
394438=====================
395439
396- The command::
440+ The command:
441+
442+ .. prompt :: bash $
397443
398444 pip install --verbose --editable .
399445
400446will build scikit-learn using your default C/C++ compiler. If you want to build
401447scikit-learn with another compiler handled by ``distutils `` or by
402- ``numpy.distutils ``, use the following command::
448+ ``numpy.distutils ``, use the following command:
449+
450+ .. prompt :: bash $
403451
404452 python setup.py build_ext --compiler=<compiler> -i build_clib --compiler=<compiler>
405453
406- To see the list of available compilers run::
454+ To see the list of available compilers run:
455+
456+ .. prompt :: bash $
407457
408458 python setup.py build_ext --help-compiler
409459
410460If your compiler is not listed here, you can specify it via the ``CC `` and
411- ``LDSHARED `` environment variables (does not work on windows)::
461+ ``LDSHARED `` environment variables (does not work on windows):
462+
463+ .. prompt :: bash $
412464
413465 CC=<compiler> LDSHARED="<compiler> -shared" python setup.py build_ext -i
414466
@@ -417,26 +469,36 @@ Building with Intel C Compiler (ICC) using oneAPI on Linux
417469
418470Intel provides access to all of its oneAPI toolkits and packages through a
419471public APT repository. First you need to get and install the public key of this
420- repository::
472+ repository:
473+
474+ .. prompt :: bash $
421475
422476 wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
423477 sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
424478 rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
425479
426- Then, add the oneAPI repository to your APT repositories::
480+ Then, add the oneAPI repository to your APT repositories:
481+
482+ .. prompt :: bash $
427483
428484 sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
429485 sudo apt-get update
430486
431- Install ICC, packaged under the name ``intel-oneapi-icc ``::
487+ Install ICC, packaged under the name ``intel-oneapi-icc ``:
488+
489+ .. prompt :: bash $
432490
433491 sudo apt-get install intel-oneapi-icc
434492
435- Before using ICC, you need to set up environment variables::
493+ Before using ICC, you need to set up environment variables:
494+
495+ .. prompt :: bash $
436496
437497 source /opt/intel/oneapi/setvars.sh
438498
439- Finally, you can build scikit-learn. For example on Linux x86_64::
499+ Finally, you can build scikit-learn. For example on Linux x86_64:
500+
501+ .. prompt :: bash $
440502
441503 python setup.py build_ext --compiler=intelem -i build_clib --compiler=intelem
442504
0 commit comments