I've created the following simple piece of Python code using OR-Tools:
from ortools.sat.python import cp_model
print("1/4")
model = cp_model.CpModel()
print("2/4")
solver = cp_model.CpSolver()
print("3/4")
solver.solve(model) # <------------ crashes here!
print("4/4")
When I run it on my home computer, it obviously works fine... but when I run it on 2 different environments at work, it crashes on solver.solve()
and never prints out 4/4
.
At home I have Windows 10 Home with admin rights. At work I have Windows Server 2016 Standard and Windows 10 Enterprise, no admin rights.
All 3 machines have exactly the same Python version:
Python 3.12.1 (tags/v3.12.1:2305ca5, Dec 7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)] on win32
When I look into Window's Event log viewer, I see the following:
Faulting application name: python.exe, version: 3.12.1150.1013, time stamp: 0x65724223
Faulting module name: MSVCP140.dll, version: 14.36.32532.0, time stamp: 0x04a30cf0
Exception code: 0xc0000005
Fault offset: 0x0000000000012f58
Faulting application path: C:\Users\.......\Python312\python.exe
Faulting module path: C:\Windows\SYSTEM32\MSVCP140.dll
Any idea what might be the reason for crash? Maybe some corporate antivirus proces fiddling with Python execution? Should I maybe try a different (latest?) Python version?
Some other external Python libraries I've tried (e.g. pandas
, oracledb
) seem to be working fine everywhere for me.
I think this is a duplicate of Google.OrTools.Sat CPSolver.Solve causes AccessViolationException
or
OR-Tools CP-SAT python example terminates after creating solver
See the release notes: https://github.com/google/or-tools/releases/tag/v9.10
You need to either update visual studio to the latest patch, or install the latest restributable libraries.
We have multiple reports of users having their problem solved once this is done.