loguru ModuleNotFoundError when using pyinstaller

2.8k Views Asked by At

when building EXE with pyinstaller, the resulting exe file doesn't execute and the error 'ModuleNotFoundError: No module named 'loguru'' is shown. Running the pythons script works without any issues.

didn't find any solution that worked so far on Stackoverflow

1

There are 1 best solutions below

0
monotype On

The simpler solution is to use --hidden-import=loguru along with the PyInstaller script. It will add modulename as import statement silently. Hooks are better if you want to specify which import needs what additional modules. --hidden-import is simpler as a one-shot or for debugging.