I run python 2.7 in a virtual environment in which running pip freeze after activating it returns
future==0.17.1
lz4==2.1.6
pyparsing==2.3.1
PyQt4 @ file:///C:/.../PyQt4-4.11.4-cp27-cp27m-win_amd64.whl
xlrd==1.2.0
If I run python in the activated virtual environment and import lz4, it is imported successfully.
However, when I try to build the executable with pyinstaller (3.6 version) without --windowed, running the exe file from cmd gives a ImportError: No module named lz4.
So I guess that for some reason the pyinstaller cannot include the specific package.
I have tried adding running the pyinstaller command with --hidden-import=lz4, --paths="path_folder_to_lz4_inside_virtualenv", including hiddenimports=['lz4'], on the .spec file and running the pyinstaller command on the .spec file instead of the .py file (and on the .py as well), including
from PyInstaller.utils.hooks import collect_submodules
hidden_imports = collect_submodules('lz4')
on the .spec and running the pyinstaller command on both .spec and .py but the ImportError persists.
My machine has Windows 10. Note that this is a cloned virtual environment from another machine where the pyinstaller command run without any problems and the only difference is that I had Windows 7 and PyQt was not installed with a wheel file but with copying PyQt4 folder and sip.pyd from tha base installation to the environment packages folder.
Any suggestions?