From 407349357d70c0be714229f1e4ebd96984073d8b Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Sat, 16 Oct 2021 18:40:04 +0200 Subject: [PATCH 1/3] DOC improve build instructions to be friendlier to first time contributors --- doc/developers/advanced_installation.rst | 40 ++++++++++++++++++------ 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/doc/developers/advanced_installation.rst b/doc/developers/advanced_installation.rst index f5944d371a550..f64da270961a7 100644 --- a/doc/developers/advanced_installation.rst +++ b/doc/developers/advanced_installation.rst @@ -47,33 +47,53 @@ feature, code or documentation improvement). .. prompt:: bash $ - git clone git://github.com/scikit-learn/scikit-learn.git # add --depth 1 if your connection is slow - cd scikit-learn + git clone git://github.com/scikit-learn/scikit-learn.git # add --depth 1 if your connection is slow + cd scikit-learn If you plan on submitting a pull-request, you should clone from your fork instead. +#. Install a recent version of Python (3.9 is recommended at the time of writing) + for instance using [Miniforge3](https://github.com/conda-forge/miniforge#miniforge3). + Miniforge provides a conda-based distribution of Python and the most + popular scientific libraries. + + If you installed Python with conda, we recommend to create a dedicated + `conda environment`_ with all the build dependencies of scikit-learn + (namely NumPy_, SciPy_, and Cython_): + + .. prompt:: bash $ + + conda create -n sklearn-env -c conda-forge python=3.9 numpy scipy cython + conda activate sklearn-env + +#. [Alternative] If you run Linux or similar, you can instead use your system's + Python provided it is recent enough (3.7 or higher at the time of writing). + In this case, we recommend to create a dedicated virtualenv_ and install + the scikit-learn build dependencies with pip: + + .. prompt:: bash $ + + python3 -m venv sklearn-env + source sklearn-env/bin/activate + pip install wheel numpy scipy cython + #. Install a compiler with OpenMP_ support for your platform. See instructions for :ref:`compiler_windows`, :ref:`compiler_macos`, :ref:`compiler_linux` and :ref:`compiler_freebsd`. -#. Optional (but recommended): create and activate a dedicated virtualenv_ - or `conda environment`_. - -#. Install NumPy_, SciPy_, and Cython_ and build the project with pip in - :ref:`editable_mode`: +#. Build the project with pip in :ref:`editable_mode`: .. prompt:: bash $ - pip install numpy scipy cython - pip install --verbose --no-build-isolation --editable . + pip install --verbose --no-build-isolation --editable . #. Check that the installed scikit-learn has a version number ending with `.dev0`: .. prompt:: bash $ - python -c "import sklearn; sklearn.show_versions()" + python -c "import sklearn; sklearn.show_versions()" #. Please refer to the :ref:`developers_guide` and :ref:`pytest_tips` to run the tests on the module of your choice. From 5e1f5834f3eabc20a4229a754fb4663f4f6c3372 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Sat, 16 Oct 2021 19:20:27 +0200 Subject: [PATCH 2/3] Fix Miniforge3's link syntax --- doc/developers/advanced_installation.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/developers/advanced_installation.rst b/doc/developers/advanced_installation.rst index f64da270961a7..2558cf69df88f 100644 --- a/doc/developers/advanced_installation.rst +++ b/doc/developers/advanced_installation.rst @@ -54,9 +54,8 @@ feature, code or documentation improvement). instead. #. Install a recent version of Python (3.9 is recommended at the time of writing) - for instance using [Miniforge3](https://github.com/conda-forge/miniforge#miniforge3). - Miniforge provides a conda-based distribution of Python and the most - popular scientific libraries. + for instance using Miniforge3_. Miniforge provides a conda-based distribution + of Python and the most popular scientific libraries. If you installed Python with conda, we recommend to create a dedicated `conda environment`_ with all the build dependencies of scikit-learn @@ -459,6 +458,7 @@ the base system and these steps will not be necessary. .. _Homebrew: https://brew.sh .. _virtualenv: https://docs.python.org/3/tutorial/venv.html .. _conda environment: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html +.. _Miniforge3: https://github.com/conda-forge/miniforge#miniforge3 Alternative compilers ===================== From 99f649d96a91a3d618ab3b85df6a3ffbaaa73b74 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Sun, 17 Oct 2021 01:21:06 +0200 Subject: [PATCH 3/3] More explicit phrasing for the conda alternative --- doc/developers/advanced_installation.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/developers/advanced_installation.rst b/doc/developers/advanced_installation.rst index 2558cf69df88f..a66c2a802883c 100644 --- a/doc/developers/advanced_installation.rst +++ b/doc/developers/advanced_installation.rst @@ -66,10 +66,10 @@ feature, code or documentation improvement). conda create -n sklearn-env -c conda-forge python=3.9 numpy scipy cython conda activate sklearn-env -#. [Alternative] If you run Linux or similar, you can instead use your system's - Python provided it is recent enough (3.7 or higher at the time of writing). - In this case, we recommend to create a dedicated virtualenv_ and install - the scikit-learn build dependencies with pip: +#. **Alternative to conda:** If you run Linux or similar, you can instead use + your system's Python provided it is recent enough (3.7 or higher + at the time of writing). In this case, we recommend to create a dedicated + virtualenv_ and install the scikit-learn build dependencies with pip: .. prompt:: bash $