4 stars based on
Unless you have a specific need for the source code, we recommend the binary installation. Install prerequisite software Optional: Install third-party solvers Download the source code Build the source code Optional: If you anticipate needing to solve mixed-integer programs, you may want to install the open-source third-party solver SCIP:. The release is a stable version of OR-Tools that has been fully tested installing the or-tools binary all the supported platforms.
This is the best option unless you want to try out features that have been added since the most recent date. This is the latest version of OR-Tools source code integrating all features even under developmenet.
For example to clone the master issue the following command:. For example to work with the v6. If the examples run successfully, you're all set to start running OR-Tools programs. You can download the latest version of Mono from the Mono Download page. First, install Xcode Command Line Tools, which includes git. The full Xcode distribution isn't necessary. Then you have a bunch of OSS tools to install.
We recommend installing them using the "missing package manager for macOS" aka Homebrew:. The following section explains the steps for installing OR-Tools from source on Windows: If the examples run successfully, you are all set to start running OR-Tools programs. The following section describes some possible solutions in case you encounter problems installing OR-Tools, whether from source or binary:.
Sometimes Bison, a parser generator, will fail to build. Bison is only necessary for FlatZinc, a solver input language used for the MiniZinc constraint modeling language. One workaround is described on this page: Unable to connect to a repository at URL 'svn: Can't connect to host 'vcs.
Network is unreachable make: Cannot open include file: You're using Visual Studio and will need to upgrade to a later version or afterward. The system cannot find the path specified make: If this error occurs when you run make all or make pythonit means that make was unable to find Python's lib or include installing the or-tools binary.
If you see this error when trying to run one of the Installing the or-tools binary examples after having followed the instructions above, you probably installed with sudo python setup. You can run the examples with sudoe. No module named pywraplp Most likely, you're using Windows XP.
Another common error is using pipwhich pulls the wrong archive with a wrong platform. Most likely, you don't have the right versions of the ortools or protobuf modules. Installing the or-tools binary check whether this is the case, run the following command:. If this returns a message saying that your versions of Python or the protobuf modules are different from required versions or that they are not installedyou need to reinstall OR-Tools as follows:.
If you see errors when installing the Python build of OR-Tools, you can try upgrading setuptools using the instructions found here. Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.
For details, see our Site Policies. Last updated March 29, Guides Reference Support All Products. The packages to install depend on which languages you'll be using: Install third-party solvers If you anticipate needing to solve mixed-integer programs, you may want to install the open-source third-party solver SCIP: Open a terminal and navigate to the directory where you extracted the tar file. Then build it using the command: Donwload the latest release archive as: For example to clone the master issue the following installing the or-tools binary Download previous release from the GitHub release page.
Checkout to a specific time point in the revision history using a installing the or-tools binary tag. Then enter the following command: For example for SCIP you add something like this: To use OR-Tools in your project, installing the or-tools binary one of the options below: We recommend installing them using the "missing package installing the or-tools binary for macOS" aka Homebrew: Visual Studio or later Gitwhich can be downloaded from https: SVN Any version that provides svn.
When installing CMake, select the option for a command-line accessible cmake. Download the following files and unpack them: Copy the file libscipopt. Download the source code You have a couple of options to get the source code of OR-Tools: To test the third party solver installation, enter the following command to solve an integer programming problem using SCIP: Cleaning the build files If you need to re-install OR-Tools, the command: Troubleshooting The following section describes some possible solutions in case you encounter problems installing OR-Tools, whether from source or binary: General installing the or-tools binary Could not find suitable distribution for ortools Here's a sample installing the or-tools binary message: Could not find suitable distribution for Requirement.
Could not load file or assembly 'Google. This occurs when you try to install a binary distribution, but the installer is unable to build the ortools package for your operating system. In this case, you can still install and run OR-Tools from source files, and even build the python package yourself. You can do so, by following these steps: Don't forget to make sure that everything is working fine by running make test.
You will find the package under a directory called temp. No such file or directory Sometimes Bison, a parser generator, will fail to build. Cannot download pcre Here's a sample error message: Just retry until it works. Error C You're using Visual Studio and will need to upgrade to a later version or afterward. If you're using a generic Windows terminal, use a Visual Studio terminal instead. Cannot import name Most likely, you don't have the right versions of the ortools or protobuf modules.
To check whether this is the case, run the following command: If you still have problems, especially on Mac OS X, here installing the or-tools binary a workaround found installing the or-tools binary a user: Upgrade setuptools from