Do I really need this many hidden-import flags?

Viewed 157

I have a windows service written in python, which I deploy in a batch file. Part of the exe creation process is this command:

pyinstaller .... myservice.py

As I debugged the failing command, I had to keep adding hidden imports each time the command failed with a new missing module.

I got it to work with this (ridiculously long) command:

pyinstaller -F --debug --paths %USERPROFILE%\AppData\Local\Programs\Python\Python36\Lib\site-packages\scipy\extra-dll --hidden-import=statsmodels --hidden-import=shared --hidden-import=win32timezone --hidden-import=pandas._libs.tslibs.timedeltas --hidden-import=sklearn --hidden-import=sklearn.neighbors --hidden-import sklearn.neighbors.typedefs --hidden-import=sklearn.neighbors.quad_tree --hidden-import=sklearn.tree._utils --hidden-import=scipy._lib.messagestream --hidden-import=statsmodels.tsa.statespace._filters --hidden-import=statsmodels.tsa.statespace._filters._conventional --hidden-import=statsmodels.tsa.statespace._filters._univariate --hidden-import=statsmodels.tsa.statespace._filters._inversions --hidden-import=statsmodels.tsa.statespace._smoothers --hidden-import=statsmodels.tsa.statespace._smoothers._conventional --hidden-import=statsmodels.tsa.statespace._smoothers._univariate --hidden-import=statsmodels.tsa.statespace._smoothers._classical --hidden-import=statsmodels.tsa.statespace._smoothers._alternative Baseline\myservice.py

This is a bit easier to read:

pyinstaller -F --debug --paths 
%USERPROFILE%\AppData\Local\Programs\Python\Python36\Lib\site-
packages\scipy\extra-dll --hidden-import=statsmodels --hidden-import=shared -
-hidden-import=win32timezone --hidden-import=pandas._libs.tslibs.timedeltas -
-hidden-import=sklearn --hidden-import=sklearn.neighbors --hidden-import 
sklearn.neighbors.typedefs --hidden-import=sklearn.neighbors.quad_tree --
hidden-import=sklearn.tree._utils --hidden-import=scipy._lib.messagestream --
hidden-import=statsmodels.tsa.statespace._filters --hidden-import=statsmodels
.tsa.statespace._filters._conventional --hidden-import=statsmodels.tsa.
statespace._filters._univariate --hidden-import=statsmodels.tsa.statespace.
_filters._inversions --hidden-import=statsmodels.tsa.statespace._smoothers --
hidden-import=statsmodels.tsa.statespace._smoothers._conventional --hidden-
import=statsmodels.tsa.statespace._smoothers._univariate --hidden-
import=statsmodels.tsa.statespace._smoothers._classical --hidden-
import=statsmodels.tsa.statespace._smoothers._alternative 
Baseline\myservice.py

Do I need all these? Or is there some kind of dynamic / wildcard way to handle some of these?

0 Answers
Related