-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUESTION] Support for ortools 9.4 solvers natively on MacOS with Silicon? #196
Comments
UPDATE: I've provided a minimal repro sample in the main description for anyone who is able to run it on a Silicon Mac w/o Rosetta2 to confirm my experience or shed some light on whether this is a bug, incompatibility, or just a usage mistake. Thanks in advance! |
Thanks, @tboddyspargo, for the detailed explanation. As you perfectly indicated, it seems this is a problem on the ortools library, specifically on the SWIG python wrapper of the CP-SAT solver C++ code. Unfortunately, I am not a macOS user, and I am unable to reproduce this error locally. However, I will try using similar macOS settings on the GitHub actions https://github.com/guillermo-navas-palencia/optbinning/blob/master/.github/workflows/python-package.yml. To be checked:
|
Update: https://github.com/guillermo-navas-palencia/optbinning/actions/runs/3198387167 Using macos-12 and ortools 9.4.1874 all tests passed. |
Thank you so much for your response, @guillermo-navas-palencia! I really appreciate the help investigating this.
I can confirm that
That's really great to hear! That makes it sound like this is more likely related to a problem on my end... I guess the first thing I'll try is to clear my pip cache and start a fresh virtual environment and try again, focusing on my minimal repro example. |
UPDATE: It works after clearing my venv and pip cache and installing only the packages necessary for the minimal repro I provided. The minimal repro example also helped surface an exception from the crashing thread. When run with my original dependency lockfile from a standard python interpreter (not a jupyter notebook), I see this line get printed:
output of `pip freeze` in working example
output of `pip freeze` in broken example
I was able to further reduce the package version differences between those two examples so the issue doesn't seem to be related to the versions of any of the dependencies. That leaves the possibility that the issue is related to the presence of one of the many "extra" packages in my original lockfile which are absent in the working minimal repro requirements. One other difference is that I currently have a work-around in place to allow I'm going to try to continue eliminating variables to see where that gets me. |
I was able to find the key variable! The issue is reproducible if Here's a more straightforward reproduction: python -m venv binning-error
source binning-error/bin/activate
pip install --upgrade pip wheel
pip install optbinning==0.15.1 pyarrow==5.0.0 Then run the following python script: # repro.py - requires pyarrow to be installed.
import optbinning
from ortools.sat.python import cp_model
print("testing cp_model.CpSolver()")
model = cp_model.CpModel()
num_vals = 3
x = model.NewIntVar(0, num_vals - 1, 'x')
y = model.NewIntVar(0, num_vals - 1, 'y')
z = model.NewIntVar(0, num_vals - 1, 'z')
model.Add(x != y)
solver = cp_model.CpSolver()
print("Running solver.Solve(model)")
# NOTE: The following line will provoke a SIGBUS Fault
status = solver.Solve(model)
print(status) When running these tests with
When I've opened google/or-tools#3485 to try and get more insight into this and will be updating it with these findings shortly. @guillermo-navas-palencia - Do you think this further confirms the suspicion that the fix will be on the |
FWIW - Is the same true for |
I am afraid I cannot do much to avoid it. I prefer to avoid specific version constraints for these critical packages. |
Problem Description
My goal is to use
optbinning
with the latestortools
(9.4.1874
) on a MacOS Monterey machine with Apple Silicon and anarm64
pythonplatform.machine()
architecture (no Rosetta2). I'm currently trying to useoptbinning==0.15.0
.I am using
ContinuousOptimalBinning.fit()
, but when it eventually runs theoptimizer.solve()
method, the code seems to silently fail shortly thereafter.Minimal Reproduction Example
Once inside of
ortools
code, execution seems to stop here:https://github.com/google/or-tools/blob/82750ac12f1ee5354e1c7869894d9af3508778f2/ortools/sat/python/cp_model.py#L2190
My debugger is unable to catch any traceback or error from this series of invocations, so I don't really know what's going wrong. The trail goes cold here after invoking this method:
https://github.com/google/or-tools/blob/82750ac12f1ee5354e1c7869894d9af3508778f2/ortools/sat/python/swig_helper.cc#L60
I suspected an architecture incompatibility issue, but this version of
ortools
has a pre-built wheel for arm64, so I was inclined to trust it.optbinning
work withortools==9.4.1874
on macos arm64? Is there any version combination where this would work?The text was updated successfully, but these errors were encountered: