Or-tools: Ortools ImportError with 6.0.4217, works with 5.1.4045

Created on 15 Jun 2017  Â·  12Comments  Â·  Source: google/or-tools

First off, thanks for a wonderful tool. I hope that my referencing this issue helps make it better.

My two issues are.

  • I cannot install the python2.7 version via pip_install on linux x86-64.
  • I can easy_install, but the simple example attached fails with 6.04217 but works with 5.1.4045

I have attached two files for your consideration.

Bug Python

Most helpful comment

@lperron i have some troubles with manylinux version (6.4.4495) on Ubuntu 17.04
First of all empty RPATH for lib libortools-ccbb62f1.so
But easily fixed by

 patchelf --set-rpath "\$ORIGIN" $ORTOOLS/.libs/libortools-ccbb62f1.so 

Then i run my model to solve VRP problem, and got error:

RuntimeError: SWIG std::function invocation failed.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/vrp/vrp.py", line 433, in enough
    if model.best_score is not None and model.best_score < best_solution['score']:
  File "/home/vrp/solver.py", line 1186, in best_score
    if self._best_collector.SolutionCount() > 0:
  File "/home/vrp/.pyenv/versions/vrp-venv/lib/python3.6/site-packages/ortools/constraint_solver/pywrapcp.py", line 1577, in SolutionCount
    return _pywrapcp.SolutionCollector_SolutionCount(self)
SystemError: <built-in function SolutionCollector_SolutionCount> returned a result with an error set

I think it should be in separate issue.

All 12 comments

It should be fixed with the latest version (6.2)

I have just released 6.3?

Can you try it?

Thanks

Same issue on Python 3.5. You can fix it manually.

Check ortools can find libortools.so

python -c "from ortools.constraint_solver import _pywrapcp"

Keep reading if you see such error:

...
ImportError: libortools.so: cannot open shared object file: No such file or directory
...

Check where _pywrapcp.so is searching libs

ORTOOLS="venv/lib/python3.5/site-packages/py3_ortools-6.0.4217-py3.5-linux-x86_64.egg/ortools"
readelf -d ${ORTOOLS}/constraint_solver/_pywrapcp.so | grep PATH

Patch it to fix this issue

cp ${ORTOOLS}/constraint_solver/_pywrapcp.so ${ORTOOLS}/constraint_solver/_pywrapcp.so.orig
sudo apt-get install patchelf
patchelf --set-rpath "\$ORIGIN/.." ${ORTOOLS}/constraint_solver/_pywrapcp.so

Check again

python -c "from ortools.constraint_solver import _pywrapcp"

I do not understand why it does not find the 6.4 wheel files.
Can you try updating pip?

The wheel files have been tested, so they should work.
The only issue is to understand why it does not find the 6.4 release.

Looking at or-tools/tools/docker/build-manylinux1.sh, the command is:
pip install -U pip setuptools wheel six

Laurent Perron | Operations Research | [email protected] | (33) 1 42 68 53
00

2017-09-29 6:16 GMT+02:00 spumer notifications@github.com:

Same issue on Python 3.5. You can fix it manually.

Check ortools can find libortools.so

python -c "from ortools.constraint_solver import _pywrapcp"

Keep reading if you see such error:

...ImportError: libortools.so: cannot open shared object file: No such file or directory...

Check where _pywrapcp.so is searching libs

ORTOOLS="venv/lib/python3.5/site-packages/py3_ortools-6.0.4217-py3.5-linux-x86_64.egg/ortools"
readelf -d ${ORTOOLS}/constraint_solver/_pywrapcp.so | grep PATH

Patch it to fix this issue

cp ${ORTOOLS}/constraint_solver/_pywrapcp.so ${ORTOOLS}/constraint_solver/_pywrapcp.so.orig
sudo apt-get install patchelf
patchelf --set-rpath "\$ORIGIN/.." ${ORTOOLS}/constraint_solver/_pywrapcp.so

Check again

python -c "from ortools.constraint_solver import _pywrapcp"

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/google/or-tools/issues/420#issuecomment-333027028,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AKj17VK2p5znVLmu0sfc2rOFlRuegCE7ks5snG8qgaJpZM4N7p-Q
.

@lperron i have some troubles with manylinux version (6.4.4495) on Ubuntu 17.04
First of all empty RPATH for lib libortools-ccbb62f1.so
But easily fixed by

 patchelf --set-rpath "\$ORIGIN" $ORTOOLS/.libs/libortools-ccbb62f1.so 

Then i run my model to solve VRP problem, and got error:

RuntimeError: SWIG std::function invocation failed.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/vrp/vrp.py", line 433, in enough
    if model.best_score is not None and model.best_score < best_solution['score']:
  File "/home/vrp/solver.py", line 1186, in best_score
    if self._best_collector.SolutionCount() > 0:
  File "/home/vrp/.pyenv/versions/vrp-venv/lib/python3.6/site-packages/ortools/constraint_solver/pywrapcp.py", line 1577, in SolutionCount
    return _pywrapcp.SolutionCollector_SolutionCount(self)
SystemError: <built-in function SolutionCollector_SolutionCount> returned a result with an error set

I think it should be in separate issue.

Installed by pip install ortools==6.4.4495

I just tried the manylinux on a debian (not ubuntu).
installing from the setuptools in the ortools_example archive does not work
:-( I do not not how to fix it
using easy_install pulls the 6.1 :-(

pip install pulls the correct 6.4
It works fine on my machine, even without the RPATH part.

About the runtime error, can you send me a code that exhibits the problem?

Thanks

Laurent Perron | Operations Research | [email protected] | (33) 1 42 68 53
00

2017-09-29 11:19 GMT+02:00 spumer notifications@github.com:

Installed by pip install ortools==6.4.4495

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/google/or-tools/issues/420#issuecomment-333076423,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AKj17exVUfdSka42rethJfPp26-Jmznfks5snLY8gaJpZM4N7p-Q
.

I pushed 6.5.
Please note that I merged py3-ortools into ortools. There is now only one module called ortools on pypi.

And now the official way to install is through pip :-)

@lperron about the runtime error, this occured in new versions of or-tools in enough check callback.
Which i setup by routing.AddSearchMonitor(solver.CustomLimit(self.__enough_callback)) in Python.
In some cases i return None instead boolean. Now i'm explicit return False and True, and all fine!

Actually error occured like before, but only once and does not stuck anymore.
Conclusion: return None - stuck, return boolean - no stuck

Hi,

Concerning the issue title, I think the import now just work so I'll close this issue .
Feel free to open another for the "callback return type issue" if any...

Was this page helpful?
0 / 5 - 0 ratings