psychopy.org | Reference | Downloads | Github

Importing visual from psychopy does not work from Canopy install

I have downloaded an installed psychopy and its dependencies for Windows, and it seems to have worked. However whenever I try and import visual from pysychopy in order to create stimuli I’m not able to. Instead I get the following error:

from psychopy import visual, core # import some libraries from PsychoPy
Traceback (most recent call last):
File “”, line 1, in
File “c:\users\wjjw53\appdata\local\enthought\canopy\user\lib\site-packages\psychopy\visual_init_.py”, line 17, in
from .window import Window, getMsPerFrame, openWindows
File “c:\users\wjjw53\appdata\local\enthought\canopy\user\lib\site-packages\psychopy\visual\window.py”, line 57, in
from psychopy import core, platform_specific, logging, prefs, monitors, event
File “c:\users\wjjw53\appdata\local\enthought\canopy\user\lib\site-packages\psychopy\event.py”, line 44, in
from pyglet.window.mouse import LEFT, MIDDLE, RIGHT
File “c:\users\wjjw53\appdata\local\enthought\canopy\user\lib\site-packages\pyglet\window_init_.py”, line 1684, in
gl.create_shadow_window()
File "c:\users\wjjw53\appdata\local\enthought\canopy\user\lib\site-packages\pyglet\gl_init
.py", line 494, in create_shadow_window
shadow_window = Window(width=1, height=1, visible=False)
File "c:\users\wjjw53\appdata\local\enthought\canopy\user\lib\site-packages\pyglet\window\win32_init
.py", line 423, in init
super(Win32Window, self).init(*args, **kwargs)
File "c:\users\wjjw53\appdata\local\enthought\canopy\user\lib\site-packages\pyglet\window_init
.py", line 622, in init
EventDispatcher.init(self)

I’m using a 64 bit canopy distribution if that changes anything ? I really need this to get working quickly so any help at all would be massively appreciated.

Did the rest of the error message get cutoff? It doesn’t look complete.

sorry yeah, there was one more line that said that there was a type error if that helps at all

from psychopy import visual
Traceback (most recent call last):
File “”, line 1, in
File “c:\users\wjjw53\appdata\local\enthought\canopy\user\lib\site-packages\psychopy\visual_init_.py”, line 17, in
from .window import Window, getMsPerFrame, openWindows
File “c:\users\wjjw53\appdata\local\enthought\canopy\user\lib\site-packages\psychopy\visual\window.py”, line 57, in
from psychopy import core, platform_specific, logging, prefs, monitors, event
File “c:\users\wjjw53\appdata\local\enthought\canopy\user\lib\site-packages\psychopy\event.py”, line 44, in
from pyglet.window.mouse import LEFT, MIDDLE, RIGHT
File “c:\users\wjjw53\appdata\local\enthought\canopy\user\lib\site-packages\pyglet\window_init_.py”, line 1684, in
gl.create_shadow_window()
File "c:\users\wjjw53\appdata\local\enthought\canopy\user\lib\site-packages\pyglet\gl_init
.py", line 494, in create_shadow_window
shadow_window = Window(width=1, height=1, visible=False)
File "c:\users\wjjw53\appdata\local\enthought\canopy\user\lib\site-packages\pyglet\window\win32_init
.py", line 423, in init
super(Win32Window, self).init(*args, **kwargs)
File "c:\users\wjjw53\appdata\local\enthought\canopy\user\lib\site-packages\pyglet\window_init
.py", line 622, in init
EventDispatcher.init(self)
TypeError: expected string or buffer

Unfortunately it doesn’t help me, but it will be necessary for other who will know more, sorry I can’t be of more help. Hopefully someone else will come along soon who has a better idea.

This is likely something to do with the installation via canopy. I wonder what version of piglet is packaged there. There’s not much I can do to debug other custom installations I’m afraid

Definitely not a Canopy problem; I’ve got Anaconda but installed pyglet 1.1.4 via PIP (because looping is not supported on newer versions), and got the same problem. Installation location is the only thing different.

It could be from running it in 64-bit python though

Bump this post. I am having the same problem as skailasa. After I upgraded to pyglet 1.1.4-3 in the Canopy “Package Manager,” I received the same error message as skailasa. Before I upgraded to pyglet 1.1.4-3, an error message like this occurred, “ERROR avbin.dll failed to load. Try importing psychopy.visual as the first library (before anything that uses scipy) and make sure that avbin is installed.”