Incompatibility between highspy and or-tools
- Dominant language
- C++
- Stars
- 14.1k
- Forks
- 2.5k
- Avg merge
- 8h 39m
- Merged PRs (30d)
- 72
Description
**What version of OR-Tools and what language are you using?**
Version: ortools==9.14.6206 from PyPI
Language: Python
**Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)**
None.
**What operating system (Linux, Windows, ...) and version?**
Linux, GitHub CI Ubuntu and ArchLinux
**What did you do?**
1. Install CVXPY with its default solvers (including the `highspy` package)
2. import CVXPY (or just highs)
3. Solve a problem in CVXPY with GLOP or PDLP from OR Tools (or call them directly)
```
uv run --no-project --python 3.12 \
--with 'ortools==9.14.6206' \
--with 'highspy==1.15.1' \
python -c 'import highspy; from ortools.linear_solver import pywraplp; print(pywraplp.Solver.CreateSolver("GLOP"))'
```
**What did you expect to see**
Successful creation of the solver.
**What did you see instead?**
```
ImportError: /home/ptnobel/.cache/uv/archive-v0/Fu73w6zBZdQnl2ZR/lib/python3.12/site-packages/ortools/linear_solver/../../ortools/.libs/libortools.so.9: undefined symbol: _Z19setLocalOptionValueRK15HighsLogOptionsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERS_RSt6vectorIP12OptionRecordSaISD_EES7_
```
Make sure you include information that can help us debug (full error message, model Proto).
**Anything else we should know about your project / environment**
This issue affects all `cvxpy` + or-tools users since the latest HIGHS release.
My best attempt at a diagnosis is that OR Tools's bundled HIGHS has a symbol conflict with HIGHS from HIGHSpy. One fix I want to do on the CVXPY side is stop eagerly loading libraries, but we would like to allow users to switch solvers easily etc. and so we would appreciate if our dependencies can be simultaneously imported (which we do in CI for example, and we have explicit methods designed to fall through to other solvers when one fails that rely on the ability to simultaneously import, etc.).
--- PTN, CVXPY Maintainer
CC: @jahall @galabovaa
Contributor guide
Assessment
This issue has not been assessed yet.