Repository navigation
ModelicaSystem cannot instantiate model, but sendExpression works #478
Description
Activity
because dlls are not being found, possibly related OpenModelica/OpenModelica#16846?
Yes, same issue. Fixing it now. I guess the new installer is online in around 2 hours.
@arun3688 the installer now installs static libraries into
lib/x86_64-windows-gnu/omc. You might need to check if that directory is already on the search path. But they should be hardcoded in the executables, so probably this will work out of the box.It would be appreciated if the error could inform about which libraries are missing. I don't know if that's technically possible? I was under the assumption that for some reason it's shared libraries that are missing, not static ones, apparently that's wrong?
Yes, same issue. Fixing it now. I guess the new installer is online in around 2 hours.
Where will that be available in 2 hrs? Nightly installers are normally appearing during the night, no?
@cbu-hw i think the above issue might not be related to dll missing error i guess because that is related to github actions in the OpenModelicaSetuo, but this PR
https://github.com/OpenModelica/OMPython/pull/476should fix your issue i guess , i tested your model and it worked for me. we need to wait for the github action to pass(base) c:\OPENMODELICAGIT\OpenModelica\OMPython>python Python 3.13.5 | packaged by Anaconda, Inc. | (main, Jun 12 2025, 16:37:03) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from OMPython import ModelicaSystem >>> mod = ModelicaSystem("C:/OPENMODELICAGIT/OMEditDir/mymodel/MyModel.mo", "MyModel") >>>this PR
https://github.com/OpenModelica/OMPython/pull/476should fix your issue i guess ,Why do you think that? #476 is about directory-based packages, but my MWE is a single-file model? 🤷
@cbu-hw i tested your model in my computer and it worked, i am not using the latest nightly builds, so that is why it worked i guess
ModelicaSystemsimulates the model as well so if you try to simulate the model viasendExpressionthen it will fail as well.ModelicaSystemsimulates the model as well so if you try to simulate the model viasendExpressionthen it will fail as well.I cannot confirm that, it does not fail. Adding a line of
print(omc.sendExpression("simulate(MyModel, stopTime=3.0)"))to the sendexpression section works as expected.ModelicaSystemsimulates the model as well so if you try to simulate the model viasendExpressionthen it will fail as well.I cannot confirm that, it does not fail. Adding a line of
print(omc.sendExpression("simulate(MyModel, stopTime=3.0)"))to the sendexpression section works as expected.OK. We moved around binaries and we need to set PATH for running simulation via ModelicaSystem. I will push in a fix for it.
Yes, same issue. Fixing it now. I guess the new installer is online in around 2 hours.
Where will that be available in 2 hrs? Nightly installers are normally appearing during the night, no?
It seems today's nightly did not run sucessfully, the Windows nightly is still from yesterday morning, so I can't test if Andreas' fix resolved the problem.
Yes, we had some issues with signing release executable. We are working on it.
Using v1.28.0-dev-429-g1819321c0f-cmake from late August, I don't get the exception, and simulation completes orderly AFAICT. So this is confirmed to be a regression now.
That is a known issue. @AnHeuermann is working on it. We will let you know once a working nightly is available.
The installer
dev-861should now be updated and online.This issue still persists on my local machine. Can you test again and see if it works for you.
I still observe the crash with v1.28.0-dev.861+gec7b922228.cmake
Also let me remark that OpenModelica/OpenModelica#5809 would be very appreciated. Losing ~1h+ of productivity to switch from a working OM version to a fresh nightly as asked, then back to the working one to be able to continue to work is...frustrating and approaches being prohibitive.
I'd offer to git bisect on an OM source build (in a devcontainer) to find what introduced the problem, but there's a similar story here -- a fresh compilation takes ~hours, incremental ones I don't know yet, as the current master does not even Configure successfully on my machine.🤷 (edit: Ah I see now that that CMake kit is actually not supported)
I still observe the crash with v1.28.0-dev.861+gec7b922228.cmake
Should work fine with OpenModelica/OpenModelica#16870
I still observe the crash with v1.28.0-dev.861+gec7b922228.cmake
Should work fine with OpenModelica/OpenModelica#16870
We'll see. I'm not sure if that will work, AFAICT as detailed above the
.batfile already has the correct paths (so I don't know what the tweaks in OpenModelica/OpenModelica#16870 should improve there), but for some reasonModelicaSystemdoes not seem to observe that?No, there were some paths missing in the
.batfile e.g., the C compiler path. OpenModelica/OpenModelica#16870 sets that.Reacted by Christoph BuchnerWith v1.28.0-dev.1026+gb748b1d61d.cmake I don't get the crash with exit status 3221225781 anymore.
However, now it crashes with exit status 1OMPython.modelica_system_abc.ModelicaSystemError: Cannot execute model: Error running model executable ['C:/Users/myuser/AppData/Local/Temp/4e088cf1-03f0-42e5-9f76-2fd38c279baf/MyModel.exe', '-help=help']: Command '['C:/Users/myuser/AppData/Local/Temp/4e088cf1-03f0-42e5-9f76-2fd38c279baf/MyModel.exe', '-help=help']' returned non-zero exit status 1.
Running
.\MyModel.bat -help=help, which should be equivalent to running the exe + path setting givesLOG_STDOUT | error | -help: not implemented by this runtime
which is not surfaced by ModelicaSystem, but might be the reason behind the non-zero exit status.
Curiously enough, the (powershell)
$LastExitCodeof that call is0-- make of that what you will 🤪This should work now as expected.
There were issues with simulation command line arguments when we switched from C to Rust runtime. Just update your OM.
Confirmed fixed with v1.28.0-dev.1157, thank you!

I am encountering puzzling behaviour trying to instantiate a simple model that is located at some path (not the current directory), which gets me an exception with exit status 3221225781 (google suggests this is "dll not found") in
check_model_executable:Output:
I expect that this instantiation with
ModelicaSystemworks.By the way, OMPython should really define a
__version__attribute so that one can easily report its version.I suspect some path/environment problems, so I printed the PATH that Python sees. Please advise what I can do to add more diagnostics on the OMPython side.
The MyModel.bat content in the temporary directory is
Version and OS