Skip to content

Commit 2ec028d

Browse files
authored
DOC improve build instructions to be friendlier to first time contributors (#21353)
1 parent 034ee98 commit 2ec028d

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

doc/developers/advanced_installation.rst

+30-10
Original file line numberDiff line numberDiff line change
@@ -47,33 +47,52 @@ feature, code or documentation improvement).
4747

4848
.. prompt:: bash $
4949

50-
git clone git://github.com/scikit-learn/scikit-learn.git # add --depth 1 if your connection is slow
51-
cd scikit-learn
50+
git clone git://github.com/scikit-learn/scikit-learn.git # add --depth 1 if your connection is slow
51+
cd scikit-learn
5252

5353
If you plan on submitting a pull-request, you should clone from your fork
5454
instead.
5555

56+
#. Install a recent version of Python (3.9 is recommended at the time of writing)
57+
for instance using Miniforge3_. Miniforge provides a conda-based distribution
58+
of Python and the most popular scientific libraries.
59+
60+
If you installed Python with conda, we recommend to create a dedicated
61+
`conda environment`_ with all the build dependencies of scikit-learn
62+
(namely NumPy_, SciPy_, and Cython_):
63+
64+
.. prompt:: bash $
65+
66+
conda create -n sklearn-env -c conda-forge python=3.9 numpy scipy cython
67+
conda activate sklearn-env
68+
69+
#. **Alternative to conda:** If you run Linux or similar, you can instead use
70+
your system's Python provided it is recent enough (3.7 or higher
71+
at the time of writing). In this case, we recommend to create a dedicated
72+
virtualenv_ and install the scikit-learn build dependencies with pip:
73+
74+
.. prompt:: bash $
75+
76+
python3 -m venv sklearn-env
77+
source sklearn-env/bin/activate
78+
pip install wheel numpy scipy cython
79+
5680
#. Install a compiler with OpenMP_ support for your platform. See instructions
5781
for :ref:`compiler_windows`, :ref:`compiler_macos`, :ref:`compiler_linux`
5882
and :ref:`compiler_freebsd`.
5983

60-
#. Optional (but recommended): create and activate a dedicated virtualenv_
61-
or `conda environment`_.
62-
63-
#. Install NumPy_, SciPy_, and Cython_ and build the project with pip in
64-
:ref:`editable_mode`:
84+
#. Build the project with pip in :ref:`editable_mode`:
6585

6686
.. prompt:: bash $
6787

68-
pip install numpy scipy cython
69-
pip install --verbose --no-build-isolation --editable .
88+
pip install --verbose --no-build-isolation --editable .
7089

7190
#. Check that the installed scikit-learn has a version number ending with
7291
`.dev0`:
7392

7493
.. prompt:: bash $
7594

76-
python -c "import sklearn; sklearn.show_versions()"
95+
python -c "import sklearn; sklearn.show_versions()"
7796

7897
#. Please refer to the :ref:`developers_guide` and :ref:`pytest_tips` to run
7998
the tests on the module of your choice.
@@ -439,6 +458,7 @@ the base system and these steps will not be necessary.
439458
.. _Homebrew: https://brew.sh
440459
.. _virtualenv: https://docs.python.org/3/tutorial/venv.html
441460
.. _conda environment: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
461+
.. _Miniforge3: https://github.com/conda-forge/miniforge#miniforge3
442462

443463
Alternative compilers
444464
=====================

0 commit comments

Comments
 (0)