Skip to content

DOC improve build instructions to be friendlier to first time contributors #21353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 30 additions & 10 deletions doc/developers/advanced_installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,52 @@ 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_. 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 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 $

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.
Expand Down Expand Up @@ -439,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
=====================
Expand Down