Skip to content

DOC: Update documentation of Installing the development version of scikit-learn #31173

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

8 changes: 6 additions & 2 deletions doc/developers/advanced_installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ to build scikit-learn Cython extensions for each supported platform.
Windows
-------

First, download the `Build Tools for Visual Studio 2019 installer
First, download the `Build Tools for Visual Studio installer
<https://aka.ms/vs/17/release/vs_buildtools.exe>`_.

Run the downloaded `vs_buildtools.exe` file, during the installation you will
Expand All @@ -186,7 +186,11 @@ commands in ``cmd`` or an Anaconda Prompt (if you use Anaconda):
.. prompt:: bash C:\>

SET DISTUTILS_USE_SDK=1
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if this is still needed now that we use meson ... the DISTUTILS_USE_SDK is not needed anymore with 99% probability, the vcvarsall.bat is probably not needed.

Personally, on Windows I compile inside a miniforge prompt and I never do this ...

It would be great if you could confirm @vitorpohlenz!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also tried to install CPython from python.org and use a venv in a cmd console and same thing it works fine without setting DISTUTILS_USE_SDK and vcvarsall.bat. I opened #31202 to simplify the Windows instructions.

Copy link
Contributor Author

@vitorpohlenz vitorpohlenz Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lesteve, it seems that you are right!

I have tried creating the environment again without activating or calling the VS Environment for the compiler, and the Meson Build seems to handle it quite well.

Here is the Full log of the build. You can see that in line 15 it activates the VS Env, when running the command:

pip install --editable . --verbose --no-build-isolation --config-settings editable-verbose=true

Without the :

SET DISTUTILS_USE_SDK=1

"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64

The same message appears whether using a conda-env or virtualenv.

Summarizing, it seems that if you installed the Microsoft Visual Studio Build Tools correctly, the Meson Build will handle these things, and these commands are not necessary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vitorpohlenz for confirming this!


.. note::
The previous command is for the 2022 version of Visual Studio. If you
have a different version, you will need to adjust the year in the path accordingly.

Replace ``x64`` by ``x86`` to build for 32-bit Python.

Expand Down