This guide explains how to install OR-Tools from source, with support for Python, on Windows. Unless you plan to modify the source code or use a third-party solver with OR-Tools, we recommend the binary installation.
Although these instructions might also work on other Windows variants, we have only tested them on machines meeting the following requirements:
- Windows 10 64-bit (x86_64) with
- Microsoft Visual Studio 2017 or Visual Studio Community 2017
The following sections describe the prerequisites for installing OR-Tools from source.
To install and run OR-Tools on Windows, you must have Visual Studio 2017 or later installed on your computer with the C++ toolset for Visual Studio. You can find more details here.
To build OR-Tools programs from the command line you must use a x64 Native Tools Command Prompt (not the Developer Command Prompt). You can find more details here.
Git, which can be downloaded from https://git-scm.com/.
CMake (>= 3.5), which can be downloaded from https://www.cmake.org/download. When installing CMake, select the option for a command-line accessible cmake.
You must have at least one of the following versions of Python installed:
Then verify that you have pip 9.01 or higher available in your PATH:
python -c "import platform; print(platform.architecture())"
python -m pip --version
Download the source code
There are two distinct branches of the OR-Tools source code on GitHub: stable and master. The stable branch has been thoroughly tested and should work flawlessly on all supported platforms. The master branch is where the latest updates and improvements have been applied; it's more current, but less stable.
Download the stable source code
To get the stable source code for OR-Tools, clone the stable branch from GitHub or download the latest release in a compressed file. You can do so by clicking the Clone or download button in GitHub.
Download the master source code
To retrieve the source code from the master branch, enter
git clone -b master https://github.com/google/or-tools
Download previous releases
You can get the source code for previous releases in either of the following ways:
- Download a previous release from the GitHub release page.
- Assuming you have already created a local repository (by
git clone), you can check out a specific release using a Git tag. For example, to work with the v7.3 release instead of the master branch, enter the following commands in your local repo:
git fetch --all --tags --prune>
git checkout tags/v7.2 -b v7.2>
Build the source code
To build the source code:
- Open a terminal and navigate to the directory where you extracted the files.
Then enter the following command:
- To use a third party solver,
Makefile.localin the main
or-toolsdirectory, and add the path to the directory where you installed the solver. For example, for SCIP you would add this:
- Compile OR-Tools by entering
- You can check that everything is running correctly by entering
This runs a selection of examples for OR-Tools. If all the examples run successfully, you are ready to get started with OR-Tools.
Using a third-party solver
You can use OR-Tools with any of the following third-party solvers:
If you have already installed OR-Tools and want to configure it to use one of these solvers, do the following steps:
- Open a terminal and navigate to the
or-toolsdirectory. Then enter the following command:
Makefile.localand add the path to the directory where you installed the solver. For example, for SCIP you would add this:
- Compile OR-Tools by entering
Install the SCIP Optimization Suite
To install the SCIP Optimization Suite on Windows, simply download the x64 installer and run it.
After the installation is complete, follow the instructions in Using a third-party solver.
Cleaning the build files
If you need to re-install OR-Tools, the command:
will remove all compiled dependencies and
Makefile.local. This can be useful
for resetting to a clean state.
Then re-enter the commands
Installing OR-Tools on your operating system
You can install OR-Tools for Python on your operating system by entering