Psych711-Mac

From Lupyan Lab
Jump to: navigation, search

Installation instructions for Macs

Contents

Remove old python installations

Step zero: If needed: uninstall any versions of python that you have personally installed. This includes standalone PsychoPy. Don't touch your system version. Note: if you don't know what this means, just ignore it.

Install TextWrangler

Download and install TextWrangler here: http://www.barebones.com/products/textwrangler/download.html


Install the Enthought Python Distribution

You will need to install Python and Psychopy, which is the experiment-building library we will be using. In this class we will use the Enthought Platform which includes Python 2.7.3 and all the libraries required by Psychopy.

Very useful info: The default location of the user-installed Canopy Python libraries is here: Users/yourMacUserName/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages

Install Psychopy with its necessary libraries

1. At the terminal window, type 'python' and it should show that the Enthought version is the one that is now on your regular user path (rather than the default Mac one):

Trinley:~ omgoleus$ python
Enthought Canopy Python 2.7.3 | 32-bit | (default, Mar 25 2013, 15:42:04) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>>
o ~/.bash_profile

Now add the following as the first PATH line in the file

export PATH=~/Library/Enthought/Canopy_32bit/User/bin:/usr/local/lib:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/bin


2. Hit ctrl-D to exit python, then type

easy_install psychopy

3. Start python again and test whether the psychopy library is installed:

Mah Mac~$ python
Enthought Canopy Python 2.7.3 | 32-bit | (default, Mar 25 2013, 15:42:04) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>>import psychopy

No error message means all is well.

4. Ctrl-D (or exit() ) to get out of python and get back to the command prompt.

Install ImageMagick

We made a script to help you install this.

1. At the terminal window, copy and paste this (double click on the line to highlight whole line):

curl -O http://sapir.psych.wisc.edu/classMaterials/psych711/ClassInstall711_magick.bash; source ClassInstall711_magick.bash; rm -f ClassInstall711.bash

2. Hit return or enter your password when prompted. The whole process will take a few minutes.


Add a few shortcuts (aliases) to the working environment

At the terminal, copy/paste the following lines (probably one at a time):

echo alias psych711=\"cd ~/Box\\ Sync/Psych711_*/\" >> ~/.bash_profile
echo alias o=\"open\" >> ~/.bash_profile
source ~/.bash_profile

Test a few things

Make sure you are connected to the internet and you have joined the class Box folder and that the files synced to your computer (you should see a little round arrow when you view your folder on the web). Then do the following in a terminal window. Note: this will work only if you have a Box folder called Psych711_firstName_lastName.

cd ~/Box <press tab to autoComplete> then Psych711_ <tab autocomplete>, <enter>

You should now be in your personal Psych711 directory

If the aliases we set up above are working properly, you can get into your Psych711 folder from anywhere just by typing psych711 in the terminal. Give that a try. You should also be able to open up a file for editing by using o. E.g., go into your folder, and then type o test.py.

This should open up the test.py file in TextWrangler. If it does not open up in TextWrangler do this: Go to finder navigate to your Psych711 folder, highlight the test.py file, and press command-i (or right click and choose 'Get Info'). Then find the section called 'Open With', choose TextWrangler, and click Change All.


Next, let's test that the psychopy installation worked properly. When you're inside your Psych711 folder, type:

python test.py

You should see something trippy. If you're not in the class and so don't have a class Box account, you won't have a test.py file and so won't see anything trippy. Sorry :/ You can test that your psychopy installation is working like so:

Mah Mac~$ python
Enthought Canopy Python 2.7.3 | 32-bit | (default, Mar 25 2013, 15:42:04) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import psychopy
>>> psychopy.__version__
'1.81.02'
exit()


Now check if ImageMagick installed properly. In a NEW terminal window type:

convert >/dev/null && echo 'ImageMagick OK' || echo 'ImageMagick Not OK!  Get help!'

It will tell you if it seems to be OK.

Personal tools
Namespaces
Variants
Actions
Navigation
Download and Install
Notes for each class - will be updated ~week before each class.
Programming Exercises
Projects
Quick reference
Toolbox