psychopy.org | Reference | Downloads | Github

Problem creating visual.Window() in Spyder (python 3.6) psychopy 1.90.1 pyglet>1.3.0b1

Not sure if this is a bug report for PsychoPy - more of an FYI on what I’ve found:

I’m having a problem simply creating a Window from inside Spyder. After a little digging, I found that the problem is with pyglet versions > 1.3.0b1. Here’s what I get

Python 3.6.4 |Anaconda custom (64-bit)| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 6.1.0 -- An enhanced Interactive Python.

from psychopy import visual

win=visual.Window()
Traceback (most recent call last):

  File "<ipython-input-2-24b96ad64581>", line 1, in <module>
    win=visual.Window()

  File "C:\Users\timothy.j.williams1\Anaconda3\lib\site-packages\psychopy\visual\window.py", line 375, in __init__
    self.backend = backends.getBackend(win=self, *args, **kwargs)

  File "C:\Users\timothy.j.williams1\Anaconda3\lib\site-packages\psychopy\visual\backends\__init__.py", line 32, in getBackend
    return Backend(win, *args, **kwargs)

  File "C:\Users\timothy.j.williams1\Anaconda3\lib\site-packages\psychopy\visual\backends\pygletbackend.py", line 102, in __init__
    allScrs = defDisp.get_screens()

  File "C:\Users\timothy.j.williams1\Anaconda3\lib\site-packages\pyglet\canvas\base.py", line 65, in get_screens
    raise NotImplementedError('abstract')

NotImplementedError: abstract

I was getting ready to post this before looking into pyglet, then I tried it from a PowerShell terminal (cmd terminals are disabled), and it worked fine. Everything is also fine with my python 2.7 environment (psychopy version 1.85.3, pyglet 1.2.4). I haven’t tried different pyglet versions there.

pyglet 1.3.2 works fine in my python 2.7 environment.

I have the same problem.

I tried to downgrade pyglet on py Python 3.6 env, but it automatically downgrade Python too.

I didn’t have that problem. How did you reinstall pyglet? Here’s what I did:

PS L:\> C:\Users\timothy.j.williams1\Anaconda3\python.exe -m pip install pyglet==1.3.0b1
Collecting pyglet==1.3.0b1
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/f1/d2/185f9b7a60d65a5d287d65e15c0f52e4f611fd651618a2f0e6387931889
5/pyglet-1.3.0b1-py2.py3-none-any.whl
Requirement already satisfied: future in c:\users\timothy.j.williams1\anaconda3\lib\site-packages (from pyglet==1.3.0b1)
 (0.16.0)
Installing collected packages: pyglet
  Found existing installation: pyglet 1.3.2
    Uninstalling pyglet-1.3.2:
      Successfully uninstalled pyglet-1.3.2
Successfully installed pyglet-1.3.0b1
1 Like

I have the some problem.
Python 3.6.1, Psychopy 1.90.1, pyglet 1.3.1

If I downgrade pyglet to 1.3.0, it works fine. Hopefully psychopy experts can fix it soon.