Starting with PsychoPy

PsychoPy is an open-source software package written in the Python programming language primarily for use in neuroscience and experimental psychology research. It’s one of our favorite ways to create experiments and we will use it through our tutorials.

So, let’s start and install PsychoPy!!!

Install PsychoPy

As reported on the PsychoPy website, there are multiple ways to install PsychoPy. Our favorite way to install it is using conda (refer to the Getting started with python).

Psychopy offers a nice .yml file that will install a basic environment for running Psychopy. You can download the file from their website.

We have also made a more complete environment, which contains Psychopy as well as Spyder (which is a python IDE) and tobii_research (which allows you to interact with an eye-tracker). You can download here our environment from our github repository.

Now open the Anaconda prompt. Make sure to set the directory to where the .yml file is, for example

cd C:\Users\ThisPC\Downloads

And then install the conda environment:

conda env create -f  your_dowloaded_file.yml

This will take some time and will ask for confirmation but in the end you will have a nice virtual environment containing everything you need to run your experiment on PsychoPy.

The virtual environment will be called “psychopy” and you can activate it just by typing:

conda activate psychopy

Check our new environmnet

We are done!! You now should have a nice conda environment called “psychoPy” with PsychoPy and few more things in it. You can always check which environment you have on your pc by typing:

conda env list

We recommend using the Psychopy environment to create and run your studies. You can use your base environment (or create additional ones) to install more libraries and analyze the data. This approach will keep everything organized and prevent compatibility issues with Psychopy.

From conda to..

But how to use all the cool things that are in this new environment? After you activate the environment, to launch the PsychoPy Gui (also referred to as Builder) you can just type psychopy in your Anaconda prompt and PsychoPy will launch. You are definitely free to try the Builder or the Coder that PsychoPy offers, however we usually prefer to write and launch our scripts from Spyder, let’s be honest, if you want to code your experiment the Gui of Spyder is way better!!

Thus we suggest to launch Spyder in your newly created “psychopy” environment. You can do that just by simply typing in spyder in your activated environment. After few seconds you should be in Spyder with all its glory !!!

Good job!! in the next tutorial we will see how to use Psychopy to create our first study!! Let’s go!!!

Back to top