psychopy.org | Reference | Downloads | Github

Psychopy3 Application different than pip install psychopy. Iohub errors on ide/console but not psychopy3

I am able to run my experiment in the psychopy3 application, but not using the pip 3.6.8 (which is where I initially built it). After finishing writing my experiment and had it refined to my requirements using an IDE, I tested it on a VM as well as a fresh python 3.6 install. So far I have had to install pyo separately and direct the swig file path but after successfully installing psychopy, when running the experiment, I run into issues regarding the iohub server.

My ide is visual studio code but I also run into trouble when running it straight off the command prompt.

In the psychopy experiment runner:
 ## Running: C:\Users\path\Experiment2_run_v3.py ##
 pygame 1.9.6
 Hello from the pygame community. https://www.pygame.org/contribute.html
 9.7254     WARNING     We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use ['pyo', 'sounddevice', 'PTB', 'pygame'] (in that order).
 16.9916     WARNING     User requested fullscreen with size [800 600], but screen is actually [1920, 1080]. Using actual size
 ##### Experiment ended. #####

When testing on the IDE, I experienced a recursion error loop of this traceback.

 
 Traceback (most recent call last):
   File "src\gevent\greenlet.py", line 854, in gevent._greenlet.Greenlet.run
   File "C:\Users\Tolly\AppData\Local\Programs\Python\Python36\lib\site-packages\gevent\baseserver.py", line 34, in _handle_and_close_when_done
     return handle(*args_tuple)
   File "C:\Users\Tolly\AppData\Local\Programs\Python\Python36\lib\site-packages\psychopy\iohub\server.py", line 76, in handle
     request_type = unicode(request.pop(0), 'utf-8') # convert bytes to string for compatibility
 TypeError: decoding str is not supported
 2020-04-21T10:03:04Z <Greenlet at 0x1e6710cd148: _handle_and_close_when_done(<bound method udpServer.handle of <udpServer at 0x, <bound method BaseServer.do_close of <udpServer at, (b'\x91\xb0GET_IOHUB_STATUS', ('127.0.0.1', 57202))> failed with TypeError

When interrupting the recursions (ctrl + c) in my IDE:

During handling of the above exception, another exception occurred:

  File "src\gevent\_waiter.py", line 192, in gevent.__waiter.MultipleWaiter.get
Traceback (most recent call last):
  File "c:/Users/path/E2_experiment/Experiment2_run_v3.py", line 244, in <module>
  File "src\gevent\_waiter.py", line 151, in gevent.__waiter.Waiter.get
    io = iohub.client.launchHubServer()
  File "C:\Users\Tolly\AppData\Local\Programs\Python\Python36\lib\site-packages\psychopy\iohub\lazy_import.py", line 278, in __call__
  File "src\gevent\_greenlet_primitives.py", line 61, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
    return obj(*args, **kwargs)
  File "C:\Users\Tolly\AppData\Local\Programs\Python\Python36\lib\site-packages\psychopy\iohub\client\connect.py", line 262, in launchHubServer
  File "src\gevent\_greenlet_primitives.py", line 61, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
    return ioHubConnection(iohub_config)
  File "src\gevent\_greenlet_primitives.py", line 65, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
  File "C:\Users\Tolly\AppData\Local\Programs\Python\Python36\lib\site-packages\psychopy\iohub\client\__init__.py", line 294, in __init__
  File "src\gevent\__greenlet_primitives.pxd", line 35, in gevent.__greenlet_primitives._greenlet_switch
    self.iohub_status = self._startServer(ioHubConfig, ioHubConfigAbsPath)
  File "C:\Users\Tolly\AppData\Local\Programs\Python\Python36\lib\site-packages\psychopy\iohub\client\__init__.py", line 976, in _startServer
KeyboardInterrupt
    if self._waitForServerInit() is False:
  File "C:\Users\Tolly\AppData\Local\Programs\Python\Python36\lib\site-packages\psychopy\iohub\client\__init__.py", line 1028, in _waitForServerInit
    r = self._sendToHubServer(['GET_IOHUB_STATUS', ])
  File "C:\Users\Tolly\AppData\Local\Programs\Python\Python36\lib\site-packages\psychopy\iohub\client\__init__.py", line 1156, in _sendToHubServer
    result = self.udp_client.receive()
  File "C:\Users\Tolly\AppData\Local\Programs\Python\Python36\lib\site-packages\psychopy\iohub\net.py", line 81, in receive
    data, address = self.sock.recvfrom(self._rcvBufferLength)
KeyboardInterrupt
6.6670  WARNING         We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use ['pyo', 'sounddevice', 'PTB', 'pygame'] (in that order).
ioHub Server Process Completed With Code:  1

windows 10
packages manually installed in python3.6.8: psychopy, winhook, pyhook, pyo, swig

I have attached my two python files to assist in troubleshooting for reference.

Experiment2_run_v3.py (14.5 KB) Experiment2_setup.py (2.0 KB)

The line breaks at:

io = iohub.client.launchHubServer()

I noticed the psychopy file doesn’t have client.launchHubServer() so changed it to client.connect.launchHubServer() and still received the same error messages.

My closest guess is that I need a certain package versions to run this file.

Did you sort this out? I also encountered similar errors…

image

Unfortunately not in my Python IDE. Only in the psychopy standalone.

  • Have you done the usual first line fixes of uninstalling/reinstalling your psychopy?

  • Are you also using apple products? Because I found my results far more consistent when I used a window machine but it was very dependent on a users setup whether they ran into a microphone problems later.

1 Like

I am using an apple laptop, and just updated the operating system. I’ll reinstall and report back.

Thanks

No luck for me. Nor for another person who also tried running on Linux without success. Fail to play sequence of MP4 videos across trials

Not sure what to try next…