psychopy.org | Reference | Downloads | Github

AttributeError: module 'pyglet.font' has no attribute 'Text'"

OS : Ubuntu 18.04
PsychoPy version : 3.1.5

What specifically went wrong when you tried that?:
I am trying to run my experiment script, but it shows " File "

######## Running: /home/jiangtian/Documents/sense_judgement_lastrun.py #########
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
0.4475 WARNING sounddevice audio lib was requested but not loaded: sounddevice not working
0.5160 WARNING pyo audio lib was requested but not loaded: ModuleNotFoundError(“No module named ‘pyo’”,)
1.2117 WARNING Import Error: No module named ‘psychtoolbox’. Using event module for keyboard component.
2.9977 WARNING t of last frame was 2.75ms (=1/363)
3.0010 WARNING t of last frame was 3.32ms (=1/301)
3.0031 WARNING t of last frame was 2.16ms (=1/463)
3.0110 WARNING t of last frame was 2.42ms (=1/413)
3.0157 WARNING Multiple dropped frames have occurred - I’ll stop bothering you about them!
Traceback (most recent call last):
File “/home/jiangtian/Documents/sense_judgement_lastrun.py”, line 83, in
depth=0.0);
File “/home/jiangtian/.local/lib/python3.6/site-packages/psychopy/visual/text.py”, line 209, in init
self.setText(text, log=False)
File “/home/jiangtian/.local/lib/python3.6/site-packages/psychopy/visual/text.py”, line 354, in setText
setAttribute(self, ‘text’, text, log)
File “/home/jiangtian/.local/lib/python3.6/site-packages/psychopy/tools/attributetools.py”, line 141, in setAttribute
setattr(self, attrib, value)
File “/home/jiangtian/.local/lib/python3.6/site-packages/psychopy/tools/attributetools.py”, line 32, in set
newValue = self.func(obj, value)
File “/home/jiangtian/.local/lib/python3.6/site-packages/psychopy/visual/text.py”, line 345, in text
self._setTextShaders(text)
File “/home/jiangtian/.local/lib/python3.6/site-packages/psychopy/visual/text.py”, line 360, in _setTextShaders
self._pygletTextObj = pyglet.font.Text(
AttributeError: module ‘pyglet.font’ has no attribute ‘Text’
"

I fixed my problem. I installed the 1.4.1 version of pyglet. I deleted it and installed the 1.3.2 version which solved the problem

I am having the same problem (on a different OS) but downgrading to pyglet 1.3.2 did not help.

OS: Windows 10 Enterprise
PsychoPy version: 3.2.4

I installed PsychoPy via Anaconda as described here.

When I start the Builder and try to run an experiment, I get the following error message:

Traceback (most recent call last):
File “C:\Users\gubi\Downloads\Bandit_lastrun.py”, line 129, in
depth=-1.0);
File “c:\Rtools\my_conda\psychopy\lib\site-packages\psychopy\visual\text.py”, line 209, in init
self.setText(text, log=False)
File “c:\Rtools\my_conda\psychopy\lib\site-packages\psychopy\visual\text.py”, line 354, in setText
setAttribute(self, ‘text’, text, log)
File “c:\Rtools\my_conda\psychopy\lib\site-packages\psychopy\tools\attributetools.py”, line 141, in setAttribute
setattr(self, attrib, value)
File “c:\Rtools\my_conda\psychopy\lib\site-packages\psychopy\tools\attributetools.py”, line 32, in set
newValue = self.func(obj, value)
File “c:\Rtools\my_conda\psychopy\lib\site-packages\psychopy\visual\text.py”, line 347, in text
self._setTextNoShaders(text)
File “c:\Rtools\my_conda\psychopy\lib\site-packages\psychopy\visual\text.py”, line 495, in _setTextNoShaders
self._pygletTextObj = pyglet.font.Text(
AttributeError: module ‘pyglet.font’ has no attribute ‘Text’

After I downgraded to pyglet 1.3.2, I got the following error message:

Traceback (most recent call last):
File “C:\Users\gubi\Downloads\Bandit_lastrun.py”, line 188, in
texRes=128, interpolate=True, depth=-3.0)
File “c:\Rtools\my_conda\psychopy\lib\site-packages\psychopy\visual\image.py”, line 107, in init
self._updateList() # ie refresh display list
File “c:\Rtools\my_conda\psychopy\lib\site-packages\psychopy\visual\basevisual.py”, line 1198, in _updateList
self._updateListNoShaders()
File “c:\Rtools\my_conda\psychopy\lib\site-packages\psychopy\visual\image.py”, line 201, in _updateListNoShaders
GL.glActiveTexture(GL.GL_TEXTURE1)
File “c:\Rtools\my_conda\psychopy\lib\site-packages\pyglet\gl\lib_wgl.py”, line 106, in call
return self.func(*args, **kwargs)
File “c:\Rtools\my_conda\psychopy\lib\site-packages\pyglet\gl\lib.py”, line 63, in MissingFunction
raise MissingFunctionException(name, requires, suggestions)
pyglet.gl.lib.MissingFunctionException: glActiveTexture is not exported by the available OpenGL driver.

Can anybody help with this problem?

Thanks in advance,
Guido

PS: I also get these warnings, which I guess are not the root of the problem:

3.2953 WARNING User requested fullscreen with size [1024 768], but screen is actually [2560, 1440]. Using actual size
3.2988 WARNING Trying to use a framebuffer object but GL_EXT_framebuffer_object is not supported. Disabled
3.2988 WARNING Trying to use a framebuffer object but GL_ARB_texture_float is not supported. Disabling
3.7414 WARNING t of last frame was 4.71ms (=1/212)
3.7505 WARNING t of last frame was 3.83ms (=1/261)
3.7550 WARNING t of last frame was 4.55ms (=1/219)
3.7590 WARNING t of last frame was 3.98ms (=1/251)

maybe @dvbridges has an idea what to do about the problem?

That’s definitely a bug in PsychoPy itself. @jon hadn’t you been working on pyglet 1.4 text alignment for quite a while?

@Guido_Biele I think the issue ultimately comes down to having a very old graphics card or, more likely, a poor driver. It appears that your graphics card/driver doesn’t support opengl shaders, but most likely you’re using the windows provided driver and you could alternatively install the appropriate driver for your particular card (nvidia, intel, AMD).

The error from the original post comes from an incompatibility PsychoPy had with Pyglet v1.4.x which I have fixed in the current repository (although there are some further issues around the layout not being identical with default settings). The continued error after downgrading to 1.3.2 is caused by poor drivers

Oh, so these fixes have not been released yet. My bad :slight_smile:

Actually I just checked and Pyglet 1.4 was supported (to a degree) in v3.2 but support hadn’t been added at that stage for machines that didn’t support shaders (as in this user’s case) and that’s something that I’ve fixed as well as providing a (somewhat) more consistent alignment setting with the old system.

Thanks everyone for looking into this!

Is it sure that this is a graphics card/driver problem?
The machine is rather new, but it has a XEON processor and no extra graphics card.*
I can’t find out what driver is installed, because the system is “locked down”, which is also the reason why I installed PsychoPy via Anaconda.

The reason I am not sure that this is a hardware/driver problem is that a while ago I had the same problem, but then I could install the stand-alone version, which worked fine. (Unfortunately I can’t install the stand-alone version on the machine I used daily at work.)

Best, Guido

* This machine (which is not what we are running experiments on, but its the machine at my desk)

  • Precision 7820 Tower
  • PROCESSOR: Intel Xeon Gold 6134 3,2 GHz, 3,7 GHz Turbo
  • no extra graphics card

OK, it might actually be the driver.
it looks as if my machine has intel’s basic display adapter, which might need updated driver to work with openGL.

However, this would not explain why on my other machine PsychoPy installed via anaconda would not start an experiment due to the pyglet (1.4.9) error, but would work just fine with PsychoPy installed in its stand-alone version.