OK, after some googling around it seems to be the case that the root cause is not pickling, it is simply a pyinstaller "hidden imports" issue, but for some reason it only shows up when pickling (don't ask me why).
The following solved the immediate issue for me: edit the .spec
file to add the following hidden import with Scipy
:
hiddenimports=['scipy._lib.messagestream']
I also needed some other hidden imports related to other libraries
hiddenimports=['sklearn.neighbors.typedefs',
'scipy._lib.messagestream',
'pandas._libs.tslibs.timedeltas' ]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…