'Pyinstaller fails to import module __PyInstaller_hooks_0_IPython

I am building a project just for fun and I want to turn it into an exe but it gives me the error

PyInstaller.exceptions.ImportErrorWhenRunningHook: Failed to import module __PyInstaller_hooks_0_IPython required by hook for module c:\users\waddy\appdata\local\programs\python\python39\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks\hook-IPython.py. Please check whether module __PyInstaller_hooks_0_IPython actually exists and whether the hook is compatible with your version of c:\users\waddy\appdata\local\programs\python\python39\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks\hook-IPython.py:

I'm working with python version 3.9.1 and pyinstaller 4.5.1. I tried using the solution given here but it gives me another error AttributeError: Module 'PyQt5' has no attribute '__version__'

How could I fix this?



Solution 1:[1]

Try to uninstall pyinstaller and re-install it using pip

And if it doesn't work for you, this may will:

https://github.com/pyinstaller/pyinstaller/issues/2114

Solution 2:[2]

In my case this exception was caused by missing text-unidecode package. It was resolved by

pip install text-unidecode

Look complete traceback of exception and see if there is any other package missing in your case.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eladtopaz
Solution 2 Kamran Akram