Issue with iohub on Linux

Hello,

I wanted to use PsychoPy for eye tracking experiments, but when I tried using iohub on my Ubuntu 17.04 machine I ran into errors on executing basic iohub commands (psychopy version 1.84.02)

from psychopy.iohub import launchHubServer
io=launchHubServer()

The output is the following:

Traceback (most recent call last):
File “”, line 4, in
File “/home/hstojic/.pyenv/psychopy1852/local/lib/python2.7/site-packages/psychopy/iohub/client/init.py”, line 1510, in launchHubServer
return ioHubConnection(ioConfig)
File “/home/hstojic/.pyenv/psychopy1852/local/lib/python2.7/site-packages/psychopy/iohub/client/init.py”, line 287, in init
raise RuntimeError(“Error starting ioHub server: %s”%(self.iohub_status))
RuntimeError: Error starting ioHub server: ioHub startup timed out. iohub Server startup Failed. startup_read:

Digging through some old posts about this issue, I have found a comment by Damien Mannion on Redirecting to Google Groups in 2015 that seems to have fixed the problem for me (didn’t test thoroughly yet). In the file iohub/devices/mouse/linux2.py, I added at the top

from … import xlib

and then I commented out lines 37 and 38, and at lines 53 and 54 I added

Mouse._xdisplay = xlib.XOpenDisplay(None)
Mouse._xscreen_count = xlib.XScreenCount(Mouse._xdisplay)

It seems like this is an old problem, what is the current status? Do other Linux users have the same issue?

For completeness, I followed the manual installation of Psychopy, since I wanted to use virtualenv. After installing all the dependencies and psychopy with pip (by the way, how come 1.85.02 is not available through pip?), I manually installed xlib and wx. Here is my requirements file:

adium-theme-ubuntu==0.3.4
alabaster==0.7.8
Babel==2.3.4
backports-abc==0.5
backports.shutil-get-terminal-size==1.0.0
basemap==1.0.7
beautifulsoup4==4.5.3
cairocffi==0.7.2
cffi==1.9.1
chardet==2.3.0
colorspacious==1.1.0
configobj==5.0.6
cryptography==1.7.1
cycler==0.10.0
Cython==0.25.2
decorator==4.0.11
docutils==0.13.1
enum34==1.1.6
funcsigs==1.0.2
functools32==3.2.3.post2
gevent==1.2.2
gmpy==1.17
greenlet==0.4.12
html5lib==0.999999999
idna==2.2
imageio==2.1.2
imagesize==0.7.1
ipaddress==1.0.17
ipython==5.1.0
ipython-genutils==0.1.0
jdcal==1.0
Jinja2==2.9.5
keyring==10.3.1
keyrings.alt==2.2
lxml==3.7.3
Mako==1.0.6
MarkupSafe==0.23
matplotlib==2.0.2
meld==3.16.4
mock==2.0.0
moviepy==0.2.3.2
mpmath==0.19
msgpack-python==0.4.8
nose==1.3.7
numexpr==2.6.1
numpy==1.13.1
numpydoc==0.6.0
openpyxl==2.3.0
pandas==0.20.3
pathlib2==2.1.0
patsy==0.4.1+dev
pbr==3.1.1
pexpect==4.2.1
pickleshare==0.7.4
Pillow==4.0.0
pkg-resources==0.0.0
ply==3.9
prompt-toolkit==1.0.9
psutil==5.2.2
PsychoPy==1.84.2
ptyprocess==0.5.1
pyasn1==0.1.9
pycparser==2.17
pycrypto==2.6.1
pyglet==1.1.4
Pygments==2.2.0
pygobject==3.22.0
pyo==0.8.2
PyOpenGL==3.1.0
pyparsing==2.2.0
python-dateutil==2.6.1
python-xlib==0.19
pytz==2017.2
pyxdg==0.25
PyYAML==3.12
requests==2.10.0
roman==2.0.0
scipy==0.19.1
scour==0.32
SecretStorage==2.3.1
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.10.0
Sphinx==1.5.3
statsmodels==0.8.0rc1
stevedore==1.23.0
subprocess32==3.2.7
sympy==1.0
tables==3.3.0
tornado==4.4.2
tqdm==4.11.2
traitlets==4.3.1
unity-lens-photos==1.0
urllib3==1.15.1
virtualenv==15.1.0
virtualenv-clone==0.2.6
virtualenvwrapper==4.7.2
wcwidth==0.1.7
webencodings==0.5
wxPython==3.0.2.0
wxPython-common==3.0.2.0
xlrd==1.0.0
xlwt==0.7.5

For

Yes, it doesn’t look like the apparent fix was incorporated. I’ve created a pull request. Thanks for the reminder.