Search code examples
pythonpyinstallerexeta-lib

I am getting 'Failed to execute script main' when I double-click on the exe file in windows10


I know such question has been previously asked but I have a different problem, here when I try to double-click on my exe which I created using pyinstaller I am getting Failed to execute main script. I am using python 3.9 I tried to open it by command prompt:

main.exe

and then I am getting the following error:

File "main.py", line 4, in <module>
    import talib as ta
  File "PyInstaller\loader\pyimod03_importers.py", line 540, in exec_module
  File "talib\__init__.py", line 72, in <module>
ModuleNotFoundError: No module named 'talib.stream'
[10332] Failed to execute script main

even though I have installed TA-Lib properly


Solution

  • I got the answer for my question, it was just about adding hidden import in our command. So, the command will actually be:

    pyinstaller main.py --hidden-import talib.stream --onefile --clean --name myApp
    

    or we can also manually add it by opening our .spec file and adding the talib.stream as hidden import