-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Python: CP-SAT tutorial example crashes on Windows with 9.10.4067 #4227
Comments
most likely duplicate of: |
#4225 has been closed as solved. But the issue remains. The tutorial example is still crashing on windows with 9.10 + python3.11. Perhaps an error of compilation in python wheel on pypi ? |
With both python 3.11 and 3.12 + ortools 9.10.4067 + Windows 11 Pro, i got
(And the computation succeeds with ortools 9.9.3963) More precisely, the python versions i tried: python 3.11.0 and 3.12.2 |
Make sure to:
Update visual studio
Create a blank venv
Pip install ortools
Run the samples. It works for me.
Le ven. 10 mai 2024, 16:56, nhuet ***@***.***> a écrit :
… With both python 3.11 and 3.12 + ortools 9.10.4067 + Windows 11 Pro, i got
Segmentation fault
(And the computation succeeds with ortools 9.9.3963)
—
Reply to this email directly, view it on GitHub
<#4227 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3K5OYWLVNYVEM3WLSDZBTN25AVCNFSM6AAAAABHQOQM3WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBUG42TONZVGU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I do not have visual studio. |
You always need the visual studio redistributable libraries
Le ven. 10 mai 2024, 18:00, nhuet ***@***.***> a écrit :
… I do not have visual studio.
We need to install visual studio to make ortools work ? I never needed it
for previous versions yet.
—
Reply to this email directly, view it on GitHub
<#4227 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3KEWKWOXMLN4DXH3ULZBTVJ7AVCNFSM6AAAAABHQOQM3WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBUHA2TIMRSGE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
As I said, the previous release of ortools worked fine for me without installing anything. But indeed i think i have the redistributable libraries preinstalled. I tried to update them using the link https://aka.ms/vs/17/release/vc_redist.x64.exe found on https://learn.microsoft.com/fr-fr/cpp/windows/latest-supported-vc-redist?view=msvc-170, but it changed nothing for me. My "ultimate" goal is to make ortools 9.10 work for me on github runners "windows-latest" because i have unit tests using ortools in my ci-cd workflow. If you know the command to update their redistributable libraries on it, i would greatly appreciate it. |
it works fine: https://github.com/google/or-tools/actions/runs/8998718133 Oops: it does not test the right thing. |
ortools 9.10 results in segmentation fault on github runner windows-latest. Could maybe be solved by updating Microsoft Visual C++ Redistributable google/or-tools#4227
ortools 9.10 results in segmentation fault on github runner windows-latest. Could maybe be solved by updating Microsoft Visual C++ Redistributable google/or-tools#4227
I experienced this error on upgrading to ortools version 9.10, and upgrading the Virtual Studio C++ redistributable at the link above (https://aka.ms/vs/17/release/vc_redist.x64.exe) fixed the problem for me. |
ortools 9.10 results in segmentation fault on github runner windows-latest. Could maybe be solved by updating Microsoft Visual C++ Redistributable google/or-tools#4227
Most likely this is fixed. |
Hey, I was having the same problem. Windows 11, python 3.12, ortools 9.10.4067. from ortools.init.python import init
from ortools.linear_solver import pywraplp
def main():
print("Google OR-Tools version:", init.OrToolsVersion.version_string())
# Create the linear solver with the GLOP backend.
solver = pywraplp.Solver.CreateSolver("GLOP")
if not solver:
print("Could not create solver GLOP")
return
# Create the variables x and y.
x_var = solver.NumVar(0, 1, "x")
y_var = solver.NumVar(0, 2, "y")
print("Number of variables =", solver.NumVariables())
infinity = solver.infinity()
# Create a linear constraint, x + y <= 2.
constraint = solver.Constraint(-infinity, 2, "ct")
constraint.SetCoefficient(x_var, 1)
constraint.SetCoefficient(y_var, 1)
print("Number of constraints =", solver.NumConstraints())
# Create the objective function, 3 * x + y.
objective = solver.Objective()
objective.SetCoefficient(x_var, 3)
objective.SetCoefficient(y_var, 1)
objective.SetMaximization()
print(f"Solving with {solver.SolverVersion()}")
result_status = solver.Solve()
print(f"Status: {result_status}")
if result_status != pywraplp.Solver.OPTIMAL:
print("The problem does not have an optimal solution!")
if result_status == pywraplp.Solver.FEASIBLE:
print("A potentially suboptimal solution was found")
else:
print("The solver could not solve the problem.")
return
print("Solution:")
print("Objective value =", objective.Value())
print("x =", x_var.solution_value())
print("y =", y_var.solution_value())
print("Advanced usage:")
print(f"Problem solved in {solver.wall_time():d} milliseconds")
print(f"Problem solved in {solver.iterations():d} iterations")
if __name__ == "__main__":
init.CppBridge.init_logging("basic-example.py")
cpp_flags = init.CppFlags()
cpp_flags.stderrthreshold = True
cpp_flags.log_prefix = False
init.CppBridge.set_flags(cpp_flags)
main() In this example the line I did try to fix the problem with visual studio installer but this did not work for me. |
Can you update the visual studio redistributable libraries.
Many users reported success doing so.
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le mer. 12 juin 2024 à 10:23, RobinParmentier ***@***.***> a
écrit :
… Hey, I was having the same problem. Windows 11, python 3.12, ortools
9.10.4067.
For my future use I'll just use ortools 9.9 since that seems to work fine.
While I was trying to find a solution I also noticed a similar issue with
another python example from the documentation:
from ortools.init.python import init
from ortools.linear_solver import pywraplp
def main():
print("Google OR-Tools version:", init.OrToolsVersion.version_string())
# Create the linear solver with the GLOP backend.
solver = pywraplp.Solver.CreateSolver("GLOP")
if not solver:
print("Could not create solver GLOP")
return
# Create the variables x and y.
x_var = solver.NumVar(0, 1, "x")
y_var = solver.NumVar(0, 2, "y")
print("Number of variables =", solver.NumVariables())
infinity = solver.infinity()
# Create a linear constraint, x + y <= 2.
constraint = solver.Constraint(-infinity, 2, "ct")
constraint.SetCoefficient(x_var, 1)
constraint.SetCoefficient(y_var, 1)
print("Number of constraints =", solver.NumConstraints())
# Create the objective function, 3 * x + y.
objective = solver.Objective()
objective.SetCoefficient(x_var, 3)
objective.SetCoefficient(y_var, 1)
objective.SetMaximization()
print(f"Solving with {solver.SolverVersion()}")
result_status = solver.Solve()
print(f"Status: {result_status}")
if result_status != pywraplp.Solver.OPTIMAL:
print("The problem does not have an optimal solution!")
if result_status == pywraplp.Solver.FEASIBLE:
print("A potentially suboptimal solution was found")
else:
print("The solver could not solve the problem.")
return
print("Solution:")
print("Objective value =", objective.Value())
print("x =", x_var.solution_value())
print("y =", y_var.solution_value())
print("Advanced usage:")
print(f"Problem solved in {solver.wall_time():d} milliseconds")
print(f"Problem solved in {solver.iterations():d} iterations")
if __name__ == "__main__":
init.CppBridge.init_logging("basic-example.py")
cpp_flags = init.CppFlags()
cpp_flags.stderrthreshold = True
cpp_flags.log_prefix = False
init.CppBridge.set_flags(cpp_flags)
main()
In this example the line
init.CppBridge.init_logging("basic-example.py")
never finishes and the program crashes silently.
The code works fine for ortools 9.9 with no other changes so it seems to
me both these problems are related.
I did try to fix the problem with visual studio installer but this did not
work for me.
What exactly are the requirements of visual studio for ortools?
—
Reply to this email directly, view it on GitHub
<#4227 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3J3GIN5BIZWNPAOAV3ZHB7XPAVCNFSM6AAAAABHQOQM3WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRTGU2TKNJWGI>
.
You are receiving this because you were assigned.Message ID:
<google/or-tools/issues/4227/2163555562 ***@***.***>
|
I tried using the link that was posted here earlier (https://aka.ms/vs/17/release/vc_redist.x64.exe) but this didn't work for me. |
Same for me, the solver crashes even though I have the latest vcredist: Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810. |
FYI, I still did not succeed in making it work (and actually stopped trying, simply freezing for now ortools version). And github windows runner have recently upgraded their Microsoft Visual C++ 2015-2022 Redistributable and the example still crashes on it with ortools 9.10. |
What version of OR-Tools and what language are you using?
Version: 9.10.4067
Language: Python
Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
CP-SAT
What operating system (Linux, Windows, ...) and version?
Windows 10 Pro, 10.0.19045 build 19045
What did you do?
Run tutorial example https://developers.google.com/optimization/cp/cp_example
What did you expect to see
What did you see instead?
Process finished with exit code -1073741819 (0xC0000005)
Make sure you include information that can help us debug (full error message, model Proto).
Anything else we should know about your project / environment
9.9.3963: works as expected, prints a list of solutions
The text was updated successfully, but these errors were encountered: