I haven't been using Python long (a few months) so I was trying to keep it
simple. At one stage I was copying a spec file in place, but abandoned it
and switched back to --hidden-import, to make things more explicit whilst
dealing with this problem.
I have tried the *python -m PyInstaller* and I get an error:
*D:\Development\Python\Experimental\Pyinstaller>call
venv\Scripts\activate(venv)
D:\Development\Python\Experimental\Pyinstaller>python -m PyInstaller
--onefile --hidden-import _openpyxl --hidden-import xlsxwriter
--hidden-import openpyxl --hidden-import xlwt --clean
pyinst_excel.pyD:\Development\Python\Experimental\Pyinstaller\venv\Scripts\python.exe:
No module named PyInstaller*
I then tried installing a pyinstaller package within my venv, but that
didn't change the above.
If I don't activate / deactivate my environment. It builds the exe but I
get the module error as described before:
D:\Development\Python\Experimental\Pyinstaller>dist\pyinst_excel.exe
Traceback (most recent call last):
File "pyinst_excel.py", line 31, in <module>
add_generated_files_row(generated_files_excel, 1, date_generated)
File "pyinst_excel.py", line 25, in add_generated_files_row
writer = pd.ExcelWriter(generated_excel)
File "site-packages\pandas\io\excel\_openpyxl.py", line 18, in __init__
ModuleNotFoundError: No module named 'openpyxl'
[19828] Failed to execute script pyinst_excel
It's almost as if it expects things to be installed globally.
Thanks,
Cllive
On Monday, 17 August 2020 at 12:59:19 UTC+1 bwoodsend wrote:
> Hi,
>
> I am using a BAT file to generate the executable
>
> Grr, why does everyone instantly go for this. The spec file contains all
> your input parameters. Once you’ve called pyinstaller --onefile
> --hidden-import _openpyxl --hidden-import xlsxwriter --hidden-import
> openpyxl --hidden-import xlwt --clean pyinst_excel.py once, in future you
> can just call PyInstaller pyinst_excel.spec.
>
> But that doesn’t matter - it should still work.
>
> openpyxl.style' MissingModule
> imported by: pandas.io.excel._openpyxl
>
> 'openpyxl.styles' MissingModule
> imported by: pandas.io.excel._openpyxl
>
> This tells us that PyInstaller is aware of the openpyxl dependencies
> (even before we explicitly told it with the --hidden-imports) but can’t
> find them. This usually boils down to venvs getting mixed up. Could you run
> it as python -m PyInstaller [rest of the command here]?
>
> Brénainn
>
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyinstaller/b9a996e8-aa66-4a67-a409-1fa4fb6d7343n%40googlegroups.com.