| Reference | Downloads | Github

Experiment crashes whenever I Include Textbox Component

Win 10
Psychopy v.2020.2.10
(Not sure if this is a standalone installation, not sure what that means, but I did install it using the windows installer download and not using python packages).

Whenever I try to include a textbox component, I get an error message similar to the following one and my experiment crashes at startup. As you’ll see, it refers to an error accessing numpy. I figured it might be because the numpy module was outdated, so I went ahead and used PIP to upgrade it to the latest version 1.19.5 and that still didn’t fix it. Anyone know how to fix this so that I can use textboxes?

Traceback (most recent call last):
File “C:\Users\Arthur\Google Drive\Colorado\LGG\Shipped Versions of Tasks\mIGT v1.05 for Pavlovia\mIGT”, line 102, in
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\textbox2\”, line 160, in init
self.font = font
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\tools\”, line 32, in set
newValue = self.func(obj, value)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\textbox2\”, line 242, in font
TypeError: type numpy.ndarray doesn’t define round method

System information:
PsychoPy 2020.2.10

Paths to files on the system:
userPrefsFile: C:\Users\Arthur\AppData\Roaming\psychopy3\userPrefs.cfg
appDataFile: C:\Users\Arthur\AppData\Roaming\psychopy3\appData.cfg
demos: C:\Program Files\PsychoPy3\lib\site-packages\psychopy\demos
appFile: C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\

System Info:
Operating System: Windows-10-10.0.19041-SP0
Processor: Intel64 Family 6 Model 69 Stepping 1, GenuineIntel
CPU freq (MHz): 2301.0
CPU cores: 2 (physical), 4 (logical)
Installed memory: 8497946624 (Total), 1482416128 (Available)

Python info:
Executable path: C:\Program Files\PsychoPy3\pythonw.exe
Version: 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)]
(Selected) Installed Packages:
numpy (1.19.5)
scipy (1.4.1)
matplotlib (3.3.0)
pyglet (1.3.3)
PyGLFW (1.7.0)
pyo 0.9.7
psychtoolbox (3.0.16)
wxPython (4.1.0)

OpenGL Info:
Vendor: Intel
Rendering engine: Intel® HD Graphics 4400
OpenGL version: 4.3.0 - Build
Shaders supported: True
(Selected) Extensions:
GL_ARB_multitexture: True
GL_EXT_framebuffer_object: True
GL_ARB_fragment_program: True
GL_ARB_shader_objects: True
GL_ARB_vertex_shader: True
GL_ARB_texture_non_power_of_two: True
GL_ARB_texture_float: True
max vertices in vertex array: 1048576

No, it’s probably accessing numpy fine, which is how it knows to give that error.

That won’t do anything if you are using the standalone distribution: it is bundled with its own version of numpy, and so won’t use any external version you install.

Can you please:

  • show us a screenshot of the settings of your text box?
  • confirm that the text box demo doesn’t work either?

Probably not particularly relevant, but just in case, I was indeed able to upgrade the numpy install from version 1.18.1 to version 1.19.5. You can see this reflected in my system information which lists my numpy version as 1.19.5. In case anyone else needs to upgrade the stand alone package installs in the future, here’s how I did it in the command line:

C:\Program Files\PsychoPy3>“c:\program files\psychopy3\python.exe” -m pip install numpy --upgrade
Collecting numpy
Downloading numpy-1.19.5-cp36-cp36m-win_amd64.whl (13.2 MB)
|████████████████████████████████| 13.2 MB 1.6 MB/s
Installing collected packages: numpy
Attempting uninstall: numpy
Found existing installation: numpy 1.18.1
Uninstalling numpy-1.18.1:
Successfully uninstalled numpy-1.18.1
WARNING: The script f2py.exe is installed in ‘c:\program files\psychopy3\Scripts’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: ‘c:\program files\psychopy3\lib\site-packages\~umpy\.libs\libopenblas.PYQHXLVVQ7VESDPUVUADXEVJOBGHJPAY.gfortran-win_amd64.dll’
Consider using the --user option or check the permissions.

WARNING: You are using pip version 20.1.1; however, version 21.0 is available.
You should consider upgrading via the ‘c:\program files\psychopy3\python.exe -m pip install --upgrade pip’ command.

C:\Program Files\PsychoPy3>“c:\program files\psychopy3\python.exe” -m pip install numpy --upgrade
Requirement already up-to-date: numpy in c:\program files\psychopy3\lib\site-packages (1.19.5)
WARNING: You are using pip version 20.1.1; however, version 21.0 is available.
You should consider upgrading via the ‘c:\program files\psychopy3\python.exe -m pip install --upgrade pip’ command.

C:\Program Files\PsychoPy3>python.exe
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

import numpy
print (numpy.version)

Sure, I can share with you the settings I had in the text box, but to be clear, I tried a bunch of different settings, including the absolute default settings and got this error message. As I had edited the settings a bunch of times to try to isolate the problem, I can’t show you each iteration. So I’ll just show you the default settings with example text which causes the crash (to reiterate, every single permutation of the textbox settings I tested lead to the same crash).

FYI, today I tried to run the experiment on a new computer with a fresh install of PsychoPy and it through the same error message, so it’s not specific to the computer that I was using.

However, when I created a new experiment with ONLY the textbox component in it, it worked. So I’m guessing it has something to do with the custom code that I am I running as part of the experiment. I’m going to look in there to see if anything references numpy and see if modifying it allows the textbox to work again.

Well, I figured it out with assistance with the assistance of a random comment that Michael Harris made on the YouTube video PsychoPy released about text boxes. Turns out that you get a TypeError if the “Units” variable for the textbox is “norm” (which is the default for my experiment). All I had to do is change the “Units” to “height” and it worked fine!

1 Like

Thanks for pointing me to the comments in this video! Another comment that helped me:

“The textbox was initially left blank instead of adding anything in the Properties window. I added a single space, and the routine continued instead of terminating the experiment. All good now!”