Search code examples
pythonmodulepyinstallerexe

ModuleNotFoundError with pyinstaller but fine in Pycharm


I'm trying to convert a .py project to an .exe file using the using the Auto Py To Exe which uses the pyinstaller.

Running my code inside pycharm I get no errors. Running the .exe file i'm getting the error:

Traceback (most recent call last):
    File "objectGui.py", line 6, in <module>
    ModuleNotFoundError: No module named 'scipy'
    [19724] Failed to execute script objectGui

I've tried adding following bit of code to the conversion

--hidden-import scipy 

This does not change the error I keep getting.

Any suggestions?


Solution

  • I have found the solution in this post.

    Since I worked on my project in an environment (PyCharm) I needed to type in the command in the PyCharm terminal for it to work. I also added the hidden import:

      --hidden-import scipy 
    

    to find the module and it worked!