Pyinstaller on Windows 11: errors when resulting executable is run

Using python 3.11.5 in Windows 11. The script works perfectly when run with the command “python GrowthRates621.py -i ExampleData.txt -w 1”. However when the script is compiled to a free-standing executable using pyinstaller 5.13.2, running the executable returns to following error:

(base) C:\Users\barry\Desktop\GrowthRates>GrowthRates621 -i ExampleData.txt -w 1
Traceback (most recent call last):
  File "PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py", line 90, in <module>
  File "PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py", line 31, in _pyi_rthook
ImportError: cannot import name 'PyiFrozenImporter' from 'pyimod02_importers' (PyInstaller\loader\pyimod02_importers.py)
[6884] Failed to execute script 'pyi_rth_pkgutil' due to unhandled exception.

I have no idea what to do about this import error. Any suggestions?

I am running Windows 11 under Parallels 18 on a Mac Studio Ultra running OS Ventura.

Are you able to make any script work with your existing process for using pyinstaller and running the executable?

If not, then the first thing to do is check the documentation, and make sure you can make an example from the documentation work.

If you can, then the first thing to do is work upwards from the start, and figure out what needs to be in your script to cause the problem. Then you will have a proper picture of what the problem actually is.

Problem seems to have disappeared after updating Anaconda python - even though it said python was up to date

I got the same error message in window10.

From searching for the solution I found a hint here

Just delete previous ‘__pycache__’, ‘build’, ‘dist’ folders and ‘*.spec’ file then rebuild it.

I hope you solve it too.

Thanks!

Barry G. Hall
Director, Bellingham Research Institute
barryghall@gmail.com
http://www.bellinghamresearch.com

(Attachment PastedGraphic-1.pdf is missing)