# Get `psychopy_ext`

Quick installation:

    pip install psychopy_ext

Or clone the github repository:

    git clone https://github.com/qbilius/psychopy_ext.git

Notice however that often certain dependencies will fail to install via pip and you’ll have to do that manually. Read on what’s required and where to get that.

## Dependencies

Required

- Python 2.7
- PsychoPy 1.79.01+
- pandas 0.12+
- seaborn 0.3+ (pretty plots; not really mandatory but required for the benefit of your eyes)
- docutils (technically it is not mandatory but it will allow rendering docstrings on screen by the `exp` class)
- svgwrite (it’s used to export stimuli to SVG format, so it’s also not super mandatory but given its pip-installable, why not?)

Optional

- PyMVPA 2.3.1+ (required for the fmri class; Windows version for Python 2.7 here)
- NiBabel (required for the fmri class; install with `pip install nibabel`)
- h5py (required for the fmri class; install with `pip install h5py`)

## Preparation for installation

### Debian/Ubuntu

Add the NeuroDebian repository using instructions on their wesbite.

Then:

- Install PsychoPy for running experiments: sudo apt-get install psychopy (all its dependencies will be installed automatically)

- Install pandas for data analysis: sudo apt-get install python-pandas

- For fMRI analyses:

  > - PyMVPA: sudo apt-get install python-mvpa2
  > - NiBabel: sudo apt-get install python-nibabel

### Windows

#### Standalone PsychoPy

Total beginners might want to merely install Standalone PsychoPy distribution which contains most packages required by psychopy_ext except for pymvpa an nibabel. These packages are used for fMRI analyses and if you are planning to conduct them, then this method will not work for you (so read on).

#### Others

First, you’ll have to choose an environment to run Python. Some good options are listed in How / where do I write my own scripts?.

Next, install Python 2.7 (except if you chose Canopy). You have to add Python to your path: right-click on My Computer, go to Properties > Advanced system settings > Environment Variables..., look for Path variable in System Variables, click to edit it and add C:\Python27; (or wherever your Python is installed). Also add C:\Python27\Scripts; to have setuptools/easy_install/pip work.

Now install PsychoPy (not a standalone version) and pandas. If you intend to do fMRI analyses, also get PyMVPA2 and NiBabel.

Alternatively, consider installing a virtual machine with Debian on it <http://neuro.debian.net/#virtual-machine>_ and following the instructions above for Debian/Ubuntu.

## Installation

### Standalone PsychoPy

Download the zip file from PyPI and follow instructions on PsychoPy documentation to install it.

### Others

Many users will be satisfied by merely installing `psychopy_ext` from PyPI:

    pip install psychopy_ext

However, to have an easy access to `psychopy_ext` and customize it to your own needs, I recommend downloading the source code and placing it where you keep your other projects. There are two possibilities then to use the package:

- In run.py add a line sys.path.insert(0, ‘../psychopy_ext/’) (i.e., a relative path to the `psychopy_ext` folder)
- Or: simply append the location of psychopy_ext to PYTHONPATH

### Bleeding edge

If you want the lastest, greatest, and the least stable copy of psychopy_ext:

- If you know how to use a mouse: download and unzip `psychopy_ext` source code

- If you know how to use a keyboard:

      git clone https://github.com/qbilius/psychopy_ext.git

You are now ready to build your first project: Starting a project.