Psych711-Mac

From Lupyan_Lab_Wiki
Jump to: navigation, search

<sidebar>Psych711</sidebar> Installation instructions for Macs

Remove old python installations[edit]

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[edit]

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


Install the Enthought Python Distribution[edit]

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.

  • Register for a free academic copy of Enthought Canopy by signing up with your academic email here and follow the instructions under Request your academic license.
  • Check your email for a download link from Enthought. Download the Full install file You need to download the 32-bit version even if you have a 64-bit OS. The 64-bit version will cause compatibility problems with necessary libraries. The file is quite large so it may take a while to download. It's so big because it includes numerous libraries for scientific computing, most of which we won't be using in the class, but you might find useful later on. If you have trouble downloading the full version of Canopy using the academic license, let me know.
  • After downloading, run the file, install, into the default directory.
  • When installation is complete, launch the Canopy program to complete setup.

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[edit]

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.
 >>>
  • If you're having problems with the Python path
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[edit]

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[edit]

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[edit]

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.