Mac specific help

Quick question for anyone using a Mac with PsychoPy.

I’m trying to install manually using pip, and all seems to have gone well until I got to PyObjC, where I get the following (I had to install Xcode and the command line tools to get to this point, and mess around with xcode-select). I’ve tried with and without sudo. Any suggestions would be much appreciated.

Cheers, Jon

IT032926:~ jon$ pip install pyobjc
Collecting pyobjc
  Using cached pyobjc-3.1.1.tar.gz
Collecting py2app>=0.10 (from pyobjc)
  Using cached py2app-0.10.tar.gz
Collecting pyobjc-core==3.1.1 (from pyobjc)
  Using cached pyobjc-core-3.1.1.tar.gz
Collecting pyobjc_framework-AVKit==3.1.1 (from pyobjc)
  Using cached pyobjc-framework-AVKit-3.1.1.tar.gz
    Complete output from command python setup.py egg_info:
    warning: no directories found matching 'Scripts'
    warning: no directories found matching 'setup-lib'
    warning: no directories found matching 'source-deps'
    warning: no previously-included files matching '.DS_Store' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.pyo' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    warning: no previously-included files matching '*.dSYM/*' found anywhere in distribution
    warning: no previously-included files matching '*.dSYM' found anywhere in distribution
    warning: no previously-included files matching '__pycache__' found anywhere in distribution
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    /Users/jon/bin/gcc
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/b1/0n73cf2d2r1g_0tj_9r8pmh80000gp/T/pip-build-T_mKJk/pyobjc-framework-AVKit/setup.py", line 35, in <module>
        if fn.startswith('_AVKit')
      File "pyobjc_setup.py", line 496, in setup
        **k
      File "/Users/jon/anaconda/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/Users/jon/anaconda/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg/setuptools/dist.py", line 269, in __init__
      File "/Users/jon/anaconda/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg/setuptools/dist.py", line 313, in fetch_build_eggs
      File "/Users/jon/anaconda/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg/pkg_resources/__init__.py", line 827, in resolve
      File "/Users/jon/anaconda/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg/pkg_resources/__init__.py", line 1072, in best_match
      File "/Users/jon/anaconda/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg/pkg_resources/__init__.py", line 1084, in obtain
      File "/Users/jon/anaconda/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg/setuptools/dist.py", line 380, in fetch_build_egg
      File "/Users/jon/anaconda/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg/setuptools/command/easy_install.py", line 640, in easy_install
      File "/Users/jon/anaconda/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg/setuptools/command/easy_install.py", line 670, in install_item
      File "/Users/jon/anaconda/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg/setuptools/command/easy_install.py", line 850, in install_eggs
      File "/Users/jon/anaconda/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg/setuptools/command/easy_install.py", line 1078, in build_and_install
      File "/Users/jon/anaconda/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg/setuptools/command/easy_install.py", line 1066, in run_setup
    distutils.errors.DistutilsError: Setup script exited with error: can't copy 'build/lib.macosx-10.5-x86_64-2.7/PyObjCTest/arrays.so': doesn't exist or not a regular file
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/b1/0n73cf2d2r1g_0tj_9r8pmh80000gp/T/pip-build-T_mKJk/pyobjc-framework-AVKit/

Can’t help with that error. I’m afraid I use regular Python from python.org rather than anaconda python. For me installing pyobjc took ages but was uneventful.

But I think the only part you need for PsychoPy is pyobjc-core so try installing just that rather than all of pyobjc. If it’s just AVKit that’s causing a problem you may sidestep it.

Hi,

Two steps back/forward can’t decide on direction.

Aim: to get the psychopy.app to run on a Mac

Steps taken: installed anaconda, then used pip to install the required modules. Problematic ones included pyobjc (got from channel “jcarlin”) and wx (on anaconda this is called wxpython). So as far as I know I’ve addressed most (all?) of the dependencies.

However, when I attempt to run the app, I get the following (I believe this is Mac specific):

IT032926:app jon$ python psychopyApp.py
This program needs access to the screen.
Please run with a Framework build of python, and only when you are
logged in on the main display of your Mac.
IT032926:app jon$ 

Following a suggestion online which suggested using pythonw:

IT032926:app jon$ pythonw psychopyApp.py
Traceback (most recent call last):
  File "psychopyApp.py", line 60, in <module>
    app = PsychoPyApp(0, showSplash=showSplash)
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/psychopy/app/_psychopyApp.py", line 107, in __init__
    self.onInit(**kwargs)
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/psychopy/app/_psychopyApp.py", line 152, in onInit
    from psychopy.compatibility import checkCompatibility
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/psychopy/compatibility.py", line 4, in <module>
    import psychopy.data
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/psychopy/data.py", line 10, in <module>
    from pandas import DataFrame, read_csv
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/pandas/__init__.py", line 39, in <module>
    from pandas.core.api import *
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/pandas/core/api.py", line 10, in <module>
    from pandas.core.groupby import Grouper
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/pandas/core/groupby.py", line 40, in <module>
    from pandas.core.frame import DataFrame
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/pandas/core/frame.py", line 72, in <module>
    from pandas.core.series import Series
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/pandas/core/series.py", line 2972, in <module>
    import pandas.tools.plotting as _gfx  # noqa
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/pandas/tools/plotting.py", line 34, in <module>
    import pandas.tseries.converter as conv
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/pandas/tseries/converter.py", line 7, in <module>
    import matplotlib.units as units
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 1138, in <module>
    rcParams = rc_params()
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 981, in rc_params
    return rc_params_from_file(fname, fail_on_error)
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 1107, in rc_params_from_file
    config_from_file = _rc_params_in_file(fname, fail_on_error)
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 1024, in _rc_params_in_file
    with _open_file_or_url(fname) as fd:
  File "/Users/jon/anaconda2/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/Users/jon/anaconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 1009, in _open_file_or_url
    with io.open(fname, encoding=encoding) as f:
LookupError: unknown encoding: 

Now the psychopy splash screen loads up and then it crashes out to the prompt. I’m not savvy enough to work out why - can anyone help?

Cheers, Jon

I simply downgraded to matplotlib 1.4.3:
conda install matplotlib=1.4.3
After that, psychopyApp.py can be run via pythonw. Don’t know if this works around an Anaconda or a PsychpPy issue, though…

1 Like

I think this is a clash between wxpython and matplotlib with recent matplotlib. Just importing matplotlib is OK, but not after importing wx (or wx localization? I forget the name of the module). Not a PsychoPy’s error per se (can be seen without ever importing psychopy)

1 Like

Hi,

Just following up on this. Rather than have users open a console and type:

pythonw /Users/blah/anaconda2/bin/psychopyApp.py

to start the GUI, I wondered what steps are required on a Mac to create a startup script that I could attach a nice logo to? I.e. is there a particular mechanism I should use for creating a “program” in Applications, so that users can start psychopy?

Alternatively is it possible to “build” psychopy i.e. download python and the dependencies for PsychoPy, such that it is installed system-wide?

Most of this just comes from my lack of familiarity with python, apologies if it’s all really dumb.

Best wishes,

Jon

You could use Automator to make a double-clickable application, using nothing other than its Run shell script action.

https://parezcoydigo.wordpress.com/2011/04/09/shell-script-as-application-with-automator/

http://stackoverflow.com/questions/27263620/how-to-install-anaconda-python-for-all-users

Hi,

Thanks for the tip to use automator (I’ve never used this before - looks very useful).

One thing though, running it this way leaves the automator “gears” in the Mac Menu bar spinning away…

To have automator close automatically just background the pythonw application once it’s been invoked (and redirect output to /dev/null) i.e. my bash script looks like this:

#!/bin/bash
PYDIR=/Users/jon/anaconda2/bin
$PYDIR/pythonw $PYDIR/psychopyApp.py > /dev/null 2>&1 &

Best wishes,

Jon