Reputation: 173
I have a series of scripts, which include some computations with the pyfmi module. When I run the main function in my python environment (Spyder), I do not have any errors - the pyfmi computations run perfectly. But, when I package the whole thing using pyInstaller to make an executable, the pyfmi module causes issues.
I am able to run my GUI using the exe file. But whenever I click the button that calls the pyfmi library, I get an error on the console saying that 'No module named pyfmi.common.core'. I tried different import options such as import pyfmi
, from pyfmi import *
, from pyfmi import fmu_util
etc., but it doesn't resolve the issue.
Upvotes: 1
Views: 414
Reputation: 1
Try running the following script in order to generate your executeable:
import PyInstaller.__main__
PyInstaller.__main__.run(['YOUR_SCRIPT.py',
'--onefile',
'--hidden-import=pyfmi.common',
'--hidden-import=pyfmi.common.core',
'--hidden-import=pyfmi.fmi_util',
'--hidden-import=pyfmi.fmi_algorithm_drivers',
'--hidden-import=scipy._lib.messagestream',
'--hidden-import=assimulo.support',
'--hidden-import=assimulo.algebraic'
])
This worked for me in a file which uses
from pyfmi import load_fmu
If there are further modules missing, just add them the way it is shown here.
Upvotes: 0