Issue with PythonFMU and Simulink #250
-
Hello, I tried importing into MATLAB 2025/Simulink an FMU generated with pythonfmu (on Windows). If the FMU is simple and has no extra dependencies, it works fine. However, when I try to import an FMU that requires additional packages installed in the same virtual environment as pythonfmu, it fails. For example, I tested with a simple model that only add numpy without using it (which is part of the venv), and it still does not work. Here is the simple model:
MATLAB 2025a was launched from the same directory of the model, with the virtual environment activated. MATLAB correctly detects the venv (I can see the venv name using the pyenv command), but when I run the simulation of the FMU in Simulink, it crashes during the fmi2Instantiate function. My goal is to use other Python packages in the model that can be installed via pip. Do you have any suggestions? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I'll be honest and say that I'm pretty blank on the issue, and how to mitigate etc. But does it happen with any extra library or only a few like |
Beta Was this translation helpful? Give feedback.
-
Apparently the problem regards python 3.13 that seems not fully supported by Matlab 2025a and some "spaces" in the path folder of the pythonfmu project and python Installation. |
Beta Was this translation helpful? Give feedback.
Apparently the problem regards python 3.13 that seems not fully supported by Matlab 2025a and some "spaces" in the path folder of the pythonfmu project and python Installation.
I've solved using python 3.12 and removing all the spaces of subfolder.
Now it is working with all the extra packages I'm using, including numpy.