psychopy.org | Reference | Downloads | Github

PyInstaller: ImportError: No Module named Rect

I used PyInstaller to create a .exe file for one of my psychopy scripts. When opening the .exe I get the following error:

Traceback(most recent call last):
     File "psychopy_method.py", line 28 in <module>
     File "site-packages\psychopy\contrib\lazy_import.py", line 119, in __call__
     File "site-packages\psychopy\contrib\lazy_import.py", line 88, in _resolve
     File "site-packages\psychopy\contrib\lazy_import.py", line 203, in _import
ImportError: No module named rect
Failed to execute script psychopy_method

I’m not sure what the function of lazy_import is since it does not directly call for “rect”. Any insight to lazy_import would be appreciated.

Let me point you back to the previous answer. I’m afraid this is basically the same issue and the answer is the same:

The basic issue you’ve got is that these systems (py2exe, py2app, pyInstaller) try to detect what modules need to be packaged to run an experiment and this autodetection doesn’t always work. You might be able to force libs to be included manually, but that’s the part I’m not willing to support and debug because it’s painful!

good luck with it! :slight_smile: