Error with Tobii
Hi, I am very new to both the Tobii and opensesame/pygaze, so hopefully I can provide enough information. I am using a Tobii t60 eyetracker. I have installed opensesame (windows installer one) on to my windows 10 machine and have manually replaced the current PyGaze package with the contents of the pygaze.zip (from here: http://www.pygaze.org/2017/09/pygaze-supports-tobii-pro-sdk/). When I attempt to run the pygaze template (with Tobii selected as the eyetracker) i get the following error:
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libqtopensesame\misc\process.py", line 150, in run exp.run() File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\experiment.py", line 411, in run self.items.execute(self.var.start) File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 91, in execute self.run(name) File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 106, in run self[name].run() File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 51, in run self.experiment.items.run(_item) File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 106, in run self[name].run() File "C:\Program Files (x86)\OpenSesame\share\opensesame_plugins\pygaze_init\pygaze_init.py", line 217, in run **kwdict) File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\eyetracker.py", line 91, in __init__ from pygaze._eyetracker.libtobii import TobiiProTracker File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\_eyetracker\libtobii.py", line 9, in <module> import tobii_research as tr File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\_eyetracker\tobii_research.py", line 2, in <module> from tobiiresearch.interop import tobii_pro ImportError: No module named interop
Thank you for any help!
Comments
Hi Katie,
Here's what I would do: Simply install OpenSesame 3.2.0, and then with the Python package manager in OpenSesame install
tobiiresearch
. That way you have the latest versions of everything.Let us know if that works for you!
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Thank you for such a quick response - i've reinstalled opensesame (3.2.0) however when I try to install tobii-research using the package manager in opensesame I get the error "Failed to install tobii-research"
Thanks!
Katie
In the debug window you will see a more informative error message. My first guess is that you're not running OpenSesame as administrator?
Check out SigmundAI.eu for our OpenSesame AI assistant!
Brilliant - that worked. Thank you so much!
Thanks for this! - Can confirm that this works. It's strange that downloading "tobiiresearch" through pip, or even downloading the SDK thought the tobii site does not give you all the scripts necessary.
@sebastiaan I got a similar error message with @katiewalsh when I run the eye tracker template with Tobii as selected eye tracker (ModuleNotFoundError: No module named 'tobii_research'). I wanted to follow your suggestion but on OpenSesame 3.3.10 there is no Python package manager option under Menu → Tools → anymore.
Is there an alternative way to install the Tobii package in OpenSesame? I tried pip install as suggested here but it produces these errors:
Note that I started OpenSesame as an administrator and used the debug window. The OpenSesame installation was that from the standard windows installation.
I appreciate your help in advance!
Wisnu
Hi Wisnu,
Try
pip.main(["install", "tobii-research" ])
Does that work?
Eduard
@eduard no, unfortunately, I got the same error messages (could not find a version that satisfies the requirements; no matching distribution for X).
Hi Wisnu,
after doing some googling, it seems that Tobii-research only supports Python up to version 3.5 (see here). So you could try 2 things:
1) Install Opensesame with Python3.5 instead of 3.7. I don't think this is a good idea, as you basically take a gamble whether you break some other aspect of the software.
2) Check whether you can install it when you follow the manual instructions, (and potentially fix version issues on the fly).
3) Do more googling/annoy the tobii developers to release an update that works with Python. Maybe it is not even necessary to change much of the code, but just to repackage the code
Good luck,
Eduard
@eduard, thanks for your response. I'll try 3 and while waiting for their response, I'll try the second recommendation as well.
I already downloaded the SDK files. The manual installation guide mentioned that I should "Extract all files for your platform to the same directory as your source files". Can you guide me where to find this source files on my computer (Windows 10, 64 bit, OpenSesame 3.3.10)?
Hi Wisnu,
Sorry for the lat reply. Unfortunately, I don't know the windows file system well enough to guide you to the location. Probably somowhere in C/programs/Opensesame, but other than that I have no clue. Sorry!
Eduard
Hi @eduard ,
Sorry for my delayed reply, too. Just manage to find time to work on this. Two important updates:
If I don't put the packages in the specified path above, I got instead a ModuleNotFoundError with a message: No module named 'tobii_research'
Any advice on how to continue?
Hi,
Well, that is good news partially. The
modulenotfounderror
occurs before theImportError
. So therefore we're moving in the right direction.For this particular DLL problem, I can't give you specific advice. If the DLLs are present, it could be a path issue (Python doesn't know where to look for them). If so, this might help you: https://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows-so-it-finds-my-modules-packages
Also of relevance could be this link here, even though it is then still base don the previous tobii version.
As a next step you could try to directly import tobii to Opensesame (from within an inlinescript item). Open a new experiment, add an inline_script and add this code:
import tobii_research
to it. If you get the same error, it might indeed be a path issue, if it works however, the problem could be with Pygaze.Eduard
Hi @eduard,
Thanks for your reply. I added the inline script and got the same error. I also checked whether the module tobii_research_interop was present in the specified folder (it is; it has an extension, though: tobii_research_interop.pyd), so I did the statoverflow solution and added the pythonpath:
Unfortunately, I still got the same 'module not found' error. Note that if I remove the .pyd extension, I got this error instead:
Let me know if you have more insight and thanks for supporting me this far. I actually know the guy who wrote the blog you referred to; I'll drop him a message as well.
The next step would be to actually check in Opensesame whether the path changes were actually effective. To do so, you can work in the debug window, and try to inspect the PATH settings of Python (use stackoverflow to find command that are helpful in this case). If the relevant folder is not in the PATH, we'll know what is happening.
it is; it has an extension, though: tobii_research_interop.pyd
not sure, but that could be the issue. Maybe check the path first, and then we can look into this.
I actually know the guy who wrote the blog you referred to; I'll drop him a message as well.
This sounds like a good idea. Let us know if you got anything useful from it.
Eduard
@eduard Sorry for my long radio silence. I just had the time to work on this again; since the error initially stemmed from different versions of Python, @sebastiaan suggested installing OpenSesame through Anaconda with Python 3.8, which matches with that of the SDK. This way, if I start OpenSesame through Anaconda it could find the tobii_research module through the console command and installed it without a problem.
The last thing I had to do was to define the tracker serial number, of which guide can be found here.
Thanks, everyone for your help!
Great that it worked. Happy experimenting!
Eduard
Stumbled on this thread when searching for help with this sort of problem, getting the Tobii SDK to work with Python on one Windows workstation. I got it working just fine on one desktop PC, but could not get it to work on the laptop PC that would run the experiment.
pip install tobii_research
failed; manual installation of the SDK to the Python site-packages folder got me a little farther, but then ran into the "specified module could not be found" error even though the module was plainly visible.Based on this thread, I noticed that the desktop PC (where everything worked) ran Python 3.10.5, while the laptop ran 3.11.1. Removed Python on the laptop, installed 3.10.5, ran
pip install tobii_research
, and all was well!Thanks to everyone here for pointing me to the solution.