Install psychopy 1.90.0 using anaconda

Great news on psychopy1.90.9 supporting python3!
in the announcment ((New Release: 1.90.0 supporting Python3!)
) it was written:

better pip install psychopy including nearly all dependencies

I wish to install using anaconda3. Does it have better installation using anaconda?
The instructions here:
http://psychopy.org/installation.html#conda
Produce an error:

>>> conda config –add channels https://conda.binstar.org/erik conda install -c erik psychopy conda create -n psychopyenv psychopy
usage: conda config [-h] [--json] [--debug] [--verbose]
                    [--system | --env | --file FILE]
                    (--show [SHOW [SHOW ...]] | --show-sources | --validate | --describe [DESCRIBE [DESCRIBE ...]] | --write-default | --get [KEY [KEY ...]] | --append KEY VALUE | --prepend KEY VALUE | --set KEY VALUE | --remove KEY VALUE | --remove-key KEY | --stdin)
conda config: error: one of the arguments --show --show-sources --validate --describe --write-default --get --append --prepend/--add --set --remove --remove-key --stdin is required

Hi @oren, can you try replacing -add with --add and see if that works? See Conda docs.

@dvbridges Still doesn’t work:

conda config –-add channels https://conda.binstar.org/erik conda install -c erik psychopy conda create -n psychopyenv psychopy
usage: conda config [-h] [--json] [--debug] [--verbose]
                    [--system | --env | --file FILE]
                    (--show [SHOW [SHOW ...]] | --show-sources | --validate | --describe [DESCRIBE [DESCRIBE ...]] | --write-default | --get [KEY [KEY ...]] | --append KEY VALUE | --prepend KEY VALUE | --set KEY VALUE | --remove KEY VALUE | --remove-key KEY | --stdin)
conda config: error: one of the arguments --show --show-sources --validate --describe --write-default --get --append --prepend/--add --set --remove --remove-key --stdin is required

Ok @oren, have you tried using pip? From the conda command prompt you can use:

pip install psychopy

However, you may have some bugs that appear, which are easily solved. The first bug relates to permissions when the pywin32 dependency is installed. To fix:

pip install pywin32
pip install --upgrade pywin32
pip install psychopy

Next, you may have some issues importing the visual component when you have PsychoPy installed. The first error relates not to PsychoPy, but to Pyglet. If you are using an older version than 1.90.1, you may then need to patch the ~psychopy/visual/__init__.py file with the following:

## After import sys
if sys.platform == 'win32':
    from pyglet.libs import win32  # pyglet patch for ANACONDA install
    from ctypes import *
    win32.PUINT = POINTER(wintypes.UINT)

This will fix the first bug. Then, you may have another error in the PsychoPy Pyglet backend, so you need to go to the Anaconda site-packages/psychopy/visual/backends/pygletbackend.py and add the following under import os:

import struct 

#Then go to line 334 and change the line from:

_screenID = 0xFFFFFFFF & scrBytes

#to

_screenID = 0xFFFFFFFF & struct.unpack('P', scrBytes)[0]

This should correct any known errors in the Anaconda install. Hope this helps.

1 Like

I think David @dvbridges is correct here: there’s no reason not to just use pip within your Anaconda environment. I don’t know if that original conda channel has been updated by @erik.kastman in quite a while.

Add the following…

PUINT = POINTER(UINT)

Hi, dvbrdges. I tried your solution, but an error occurred. It seems UINT is not defined.

image

Hi @Shelling, yes there is a new fix which should be included in the latest release. Rather than change the Pyglet file, you can patch the psychopy.visual.__init__.py file:

# After import sys
if sys.platform == 'win32':
    from pyglet.libs import win32  # pyglet patch for ANACONDA install
    from ctypes import *
    win32.PUINT = POINTER(wintypes.UINT)

Thanks!