Build from source on Windows

The system compiler must be compatible with CUDA Toolkit if GPU support is required. Refer to the Supported Host Compilers section of the NVIDIA CUDA Compiler Driver NVCC documentation for more details. The required steps to change the system compiler depend on the OS.

Training on GPU requires NVIDIA Driver of version 390.xx or higher.

To build the Python package from source on Windows:
  1. Clone the repository:

    git clone
  2. (Optionally) Volta GPU users are advised to precisely set the required NVCC compile flags in the configuration file. Removing irrelevant flags speeds up the compilation.

    Note. CatBoost may work incorrectly with Independent Thread Scheduling introduced in Volta GPUs when the number of splits for features exceeds 32.
  3. (Optionally) CUDA with compute capability 2.0 users must remove all lines starting with -gencode from the configuration file and add the following line instead:
    -gencode arch=compute_20,code=compute_20
  4. Install Visual Studio Community 2017.

    • Choose the Windows Platform development and Desktop Development with C++ options in the workloads tab.
    • Choose a suitable version of the MSVC compiler. The version of MSVC for CUDA Toolkit 9.0 and 9.1 should not be higher than 15.6 v14.11, while the version for CUDA Toolkit 9.2 should not be higher than 15.6 v14.13.
    Visual Studio forcibly installs the latest version of the compiler upon each update. The latest MSVC compiler may not be suitable for compiling CatBoost, especially with CUDA. It is advised to install VC++ 2017 version 15.6 v14.13 for CUDA Toolkit 9.2 and 15.6 v14.11 for CUDA Toolkit 9.0 and 9.1.
    Identify the set version of the compiler
    1. Open the properties window for any cpp file of the project.
    2. Ensure the absence of the /nologo option in the compiler's command-line (for example, by adding the deprecated /nologo- option in the Command Line/Additional Options box).
    3. Compile this source file (Ctrl + F7).

    The set version of the compiler is printed to the Output window. CatBoost can not be compiled with 19.14.* versions.

    Change the version of the compiler
    Use one of the following methods to set the recommended version of the compiler:
    • Enable the required version as described in the Visual C++ Team Blog.

    • Run the environment setter from the command line with the vcvars_ver option (the path to the script depends on the installation settings):

      call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.13 
      Then open the solution:
      start msvs\arcadia.sln
  5. Open the catboost/catboost/python-package/catboost directory from the local copy of the CatBoost repository.

  6. Compile the packages using one of the following methods:
    • Use one of the Python versions provided by the ya make utility:

      ../../../ya make -r -DUSE_ARCADIA_PYTHON=no -DUSE_SYSTEM_PYTHON=<Python version> [optional parameters]
    • Use one of the Python versions installed on the machine:

      ../../../ya make -r -DUSE_ARCADIA_PYTHON=no -DOS_SDK=local -DPYTHON_CONFIG=<path to the required python-config> [optional parameters]
    Parameter Description
    Parameters that define the Python version to use for compiling. Only one of the following blocks of options can be used at a time

    Use one of the Python versions provided by the ya make utility


    The version of Python to use for compiling the package on machines without installed Python.

    The following Python versions are supported and can be defined as values for this parameter:
    • 2.7
    • 3.4
    • 3.5
    • 3.6

    Use one of the Python versions installed on the machine


    Defines the path to the configuration of an installed Python version to use for compiling the package.

    Value examples:
    • python2-config for Python 2
    • python3-config for Python 3
    • /usr/bin/python2.7-config
    • The configuration must be explicitly named python3-config to successfully build the package for Python 3.
    • Manually redefine the following variables when encountering problems with the Python configuration:
      • -DPYTHON_BIN
    Optional parameters

    The path to CUDA. This parameter is required to support training on GPU.


    Disable CUDA support. This speeds up compilation.

    By default, the package is built with CUDA support if CUDA Toolkit is installed.

    -o The directory to output the compiled package to. By default, the current directory is used.
    For example, the following command builds the package for Python 3 with training on GPU support:
    ../../../ya make -r -DUSE_ARCADIA_PYTHON=no -DOS_SDK=local -DPYTHON_CONFIG=python3-config -DCUDA_ROOT=/usr/local/cuda
    Explicitly specify the PYTHON_INCLUDE and PYTHON_LIBRARIES variables:
    ../../../ya make -r -DUSE_ARCADIA_PYTHON=no -DOS_SDK=local -DPYTHON_INCLUDE="/I C:/Python27/include/" -DPYTHON_LIBRARIES="C:/Python27/libs/python27.lib"