or-tools for Dummies (Win32, Python edition)

1,210 views
Skip to first unread message

fbahr

unread,
Mar 11, 2014, 4:40:41 PM3/11/14
to or-tools...@googlegroups.com
Since I'd _really_ like to use/test or-tools ...but, as it turns out, I'm not able to manage it on my own: how to install or-tools for Win32 (to be accessible from Python)?

-- building or-tools from SVN ain't no option (VS2012 requirement)
-- downloading, installing Google.OrTools.python.examples.3124.zip yields _pywrap*.dll issue
-- ...

...so?

Thanks in advance...

--fbahr

Laurent Perron

unread,
Mar 11, 2014, 4:46:55 PM3/11/14
to or-tools...@googlegroups.com
I do not know, I do not have issues on all my windows laptops.

I download the python_examples archive, run setup.py install on it, run the examples. They work.
I really believe this is due to missing redistributables, or maybe wrong python libraries, but I cannot reproduce the bug, so I cannot debug it.

So I am at loss.

Thanks
--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jose Antonio Medrano Garcia

unread,
Mar 11, 2014, 8:41:10 PM3/11/14
to or-tools...@googlegroups.com
I have suffered from this issue for a long time and now that I am taking a Coursera course it seems that the problem is not isolated, it is very common.  One of my fellow classmates posted this solution, I have not tested it yet but if you want to give it a try please let us know if it worked for you.  It may also help Laurent find the root cause for the problem.




I have been able to make or-tools work after a lot of trial and error.

Here are the steps I followed after downloading ortools from PyPI site and running into the pywrapcp error.

1. Download and copy two dlls (msvcp110.dll and msvcr110.dll - available ondll-files.com) to windows/System32 folder. 
2. Download python gflags 2.0 from PYPI
3. Download Protocol buffers (protobuf 2.5.0) for python from PYPI
4. For protobuf to work, you'll need to install C++ protobuf runtime library (protoc.exe). This is available here :https://code.google.com/p/protobuf/downloads/list. You'll need the first binary (protoc-2.5.0-win32.zip)

After running through the above steps, I have been able to run one of the sample python tutorial programs (cp_is_fun1.py) in the or-tools documentation.

Laurent Perron

unread,
Mar 11, 2014, 9:22:48 PM3/11/14
to or-tools...@googlegroups.com
OK, 
so it is indeed a problem with visual studio redistributables. Can you try the following steps:

  - download visual studio 2012 sp4 from http://www.microsoft.com/en-us/download/details.aspx?id=30679 and install the x86 version.
  - download  the python_examples archive from 


extract it, go into the directory, and run python setup.py install, it should download gflags, protobug, and a few more from pypi.
You should not need to install them manually.

and then in the python examples directory, and run python.exe <path to example>\jobshop_ft06.py?

Thanks

--Laurent

PS: I do not think you need to install protobuf binary to run the examples. I checked the zip archive, and it only contains a binary, no dlls. So it should not help.

--

fbahr

unread,
Mar 12, 2014, 2:03:37 PM3/12/14
to or-tools...@googlegroups.com
Thank you for prompt input, guys [...and, btw., yes -- as Jose indicated -- I intend to use or-tools for Van Hentenryck's Coursera class].

It seems to me like I am missing something _very_ elementary here.

- I've already had the latestest MSVC++ 2012 Redistributable [x86, 11.0.61030] on my Windows XP SP3 machine [re-installed it anyway, just to be safe], and
- I'm using a freshly installed Anaconda 1.9.1 (32-bit) installation (= Python 2.7.6).

So, then

- I've downloaded Google.OrTools.python.examples.3124.zip, unzipped its contents into a folder (let's call it TEMP), and ran python.exe setup.py install (which successfully installed or-tools, protobuf, gflags etc. in C:\Programme\Anaconda\Lib\site-packages),
- and tried (in folder TEMP) python.exe examples\pyflow_example.py

...which gives:

Traceback (most recent call last):
  File "examples\pyflow_example.py", line 19, in <module>
    from ortools.graph import pywrapgraph
  File "c:\programme\anaconda\lib\site-packages\ortools-1.3155-py2.7-win32.egg\ortools\graph\pywrapgraph.py", line 28, in <module> _pywrapgraph = swig_import_helper()
  File "c:\programme\anaconda\lib\site-packages\ortools-1.3155-py2.7-win32.egg\ortools\graph\pywrapgraph.py", line 24, in swig_import_helper
  _mod = imp.load_module('_pywrapgraph', fp, pathname, description)
ImportError: DLL load failed: The specified procedure could not be found.


To figure out whether this is a Python (or, more precisely, PYTHONPATH) specific issue, I gave Google.OrTools.java.VisualStudio2012-32b.3103.zip a shot.

RabbitsPheasants.java compiled w/o problems -- but when I try to make it run, I get:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Programme\Google\or-tools-java\lib\jniortools.dll: The specified procedure could not be found
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)
        at java.lang.Runtime.loadLibrary0(Runtime.java:845)
        at java.lang.System.loadLibrary(System.java:1084)
        at com.google.ortools.constraintsolver.samples.RabbitsPheasants.<clinit>
(RabbitsPheasants.java:32)


So, the question is... _what_ am I missing [if it helps... think of me as stupid as you possibly can]
- Do I need a lib from another binary distribtion?
- Do I need to have the SVN sources, do they have to be in a certain place (alt.: in my Windows PATH variable)?
- ...

Totally lost,
fbahr

Laurent Perron

unread,
Mar 12, 2014, 2:17:06 PM3/12/14
to or-tools...@googlegroups.com
Hi, 

Can you install http://www.dependencywalker.com/ and check the python dll (you may have to rename it from pyd to dll to check it).

For the java library, did you add the  -Djava.library.path=<path to ortools/lib> to the command line?

Thanks

Laurent Perron

unread,
Mar 12, 2014, 2:24:44 PM3/12/14
to or-tools...@googlegroups.com
Can you also try with the official python ?
http://www.python.org/download/releases/2.7.6/

Thanks
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discuss+unsubscribe@googlegroups.com.

fbahr

unread,
Mar 12, 2014, 3:30:38 PM3/12/14
to or-tools...@googlegroups.com
For the Java part:

I've unzipped the binary distribution to C:\Programme\Google\or-tools-java [which contains the lib, examples, etc. folders], and executed

C:\Programme\Google\or-tools-java>java -Djava.library.path=lib -cp objs;lib\com.google.ortools.jar com.google.ortools.constraintsolver.samples.RabbitsPheasants


For the Python part:

When I run depends.exe on _pywrapgraph.pyd, it reports 3 DLLs as missing: EFSADU.DLL, IESHIMS.DLL, WER.DLL.

- EFSADU.DLL seems to be a file encryption utility, only available in XP Pro [actually, I'd sworn to have Pro, but -- apparently -- I "run" on Home edition]
- IESHIMS.DLL and, maybe, WER.DLL [delay-load dependencies] seem related to Vista+abobe & IE9

Having this said, [to me] this pretty much reads like a MSVC++ lib issue...

--fbahr

Laurent Perron

unread,
Mar 12, 2014, 3:44:15 PM3/12/14
to or-tools...@googlegroups.com
it pretty much reads as XP not supported. Thanks for the time spent debugging.

fbahr

unread,
Mar 12, 2014, 4:25:39 PM3/12/14
to or-tools...@googlegroups.com
Damn... so it's actually about time for a new notebook.

In the meantime I've installed Google.OrTools.python.examples.3124.tar.gz on a Linux workstation I can access (only remotely, no admin privileges).

Works like a charm... (*hooray*)

...one [final?] additional question, though: linear_programming.py and integer_programming.py use CLP/CBC -- is SCIP also supported through the binary distribution, or would I have to build or-tools from the sources?

--fbahr

Laurent Perron

unread,
Mar 12, 2014, 4:34:30 PM3/12/14
to or-tools...@googlegroups.com
you have to build it. They have a special licence that forbid me to build archives containing it.

--Laurent

fbahr

unread,
Mar 12, 2014, 4:41:36 PM3/12/14
to or-tools...@googlegroups.com
Uh... that's what I've feared.

Anyhow: thanks ...again.

--fbahr
Reply all
Reply to author
Forward
0 new messages