Install instructions for Spyder4 on PsychoPy3 on Windows

If you want to be really bleeding edge, I’ve got a treat for you: using Spyder4 instead of Coder to write your python scripts. Both are in beta as of writing this. The use of Spyder as a replacement for Coder has been discussed before here. I would really like to hear if you encounter any difficulties/errors. Also, if someone on mac feels inspired, please post install instructions too!

I just tested this on Windows 10. This looks daunting, but really it’s just about 5 minutes of interaction time and then some waiting for stuff to download and install.

  1. If you haven’t already, download and install the latest PsychoPy3.
    https://github.com/psychopy/psychopy/releases

  2. Install Git for Windows. PsychoPy uses this for version control.
    https://gitforwindows.org](https://gitforwindows.org)

  3. Make it visible system-wide: Open the start menu and search “environmental” and press ENTER. Press “Environmental variables…” and press “New…”.

    Variable name: GIT_PYTHON_GIT_EXECUTABLE
    Variable value: C:\Program Files\Git\bin\git.exe (or wherever you installed Git)
    
  4. Open the start menu, type “cmd”, and open it as administrator (Ctrl+Enter).

  5. Copy-paste this, and press enter (edit paths if they are different). This will install the bleeding-edge version of Spyder inside PsychoPy’s own python using “pip”.

    C:\Program Files (x86)\PsychoPy3\python3.exe -m pip install --pre -U spyder
    
  6. Make a shortcut to the below. Edit if your paths are different. Put this shortcut somewhere convenient, e.g., on your Desktop.

    "C:\Program Files (x86)\PsychoPy3\python3.exe" "C:\Program Files (x86)\PsychoPy3\Lib\site-packages\spyder\app\start.py"
    
  7. Check that it works. In Spyder, you should be able to run the following without errors:

    from psychopy import visual. 
    

One problem with this method is that you need to redo point 4 and 5 every time you update/reinstall psychopy. But it’s manageable.

There are many advantages to using Spyder4 over Coder, including in-app documentation (no need to go to psychopy.org/api), code inspection (no need to remember methods and attributes), and it detects syntax errors as you type. But do bear in mind that we still haven’t tested whether Spyder may impact performance or reliability as compared to Coder. I’ve used Spyder for years now, and I haven’t noticed anything.

1 Like