Experimental support for python3


I have managed to use python 3.3 on my linux box with or-tools.
The biggest problem is that google apputils is not compatible with python3. So you have to patch it by hand.

Here is what I had to do:

First, update to the latest svn.
then, before running make third_party:
  sudo apt-get install python3-dev python3-setuptools

  make third_party

then install the python modules manually:
  edit <or-tools>/Makefile.local to change UNIX_PYTHON_VERSION to 3.3
  go to <or-tools>/dependencies/sources/google_apputils_python-14
    edit setup.py to change "python-dateutil>=1.4,<2", to "python-dateutil>=2",
    run: 2to3 -w <or-tools>/dependencies/sources/google_apputils_python-14
    run: python3.3 setup.py install --user
  run 2to3 on the installed python_gflags package:
    2to3 -w ~/.local/lib/python3.3/site-packages/python_gflags-2.0-py3.3.egg

You should be able to run make python and make test_python normally after that.

Please note that I have only ported the python examples called in make test_python.


  1. Hi, do you know about python3.x support plans for or-tools. Also, can you recommend any alternate constraint solvers for python3.x


Post a Comment

Popular posts from this blog

Heads up, upcoming incompatibility in the CP/Routing library

Documentation: new examples and reference manual

Changes in the last month - on windows this time