Import egi no longer working

“import egi.simple as egi” no longer works in version 1.84.0. It indicates that the module cannot be found. Similarly the EGI demo program throws the same error.

OK. I’ve rebuilt the standalone distros in 1.84 and maybe this got missed (unfortunately egi and other hardware manufacturers don’t make it easy for us to automate installing their packages so I have to manually edit the distributions).

Which platform are you talking about?

Windows 10.
Thanks (and thanks for Psychopy!)

OK, that will be included in the next standalone package release (1.84.2; but not soon) but in the meantime you could simply extract the folder egi from the zip file below and drag it into your PsychoPy2/lib/site-packages folder
https://github.com/gaelen/python-egi/archive/master.zip

I think that should make it work again

Hi everyone,

I am trying to make a EEG experiment (initially working on psychtoolbox). I use an EGI system and attempt to use the egg psynetstation library then.
However, the import egi.simple as egi is not working for me.
I get the error :

import egi.simple as egi
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/egi/simple.py", line 347
    type(1L): ('long', '=l'),  # '=' -- translation is: four bytes
          ^

When I try to run line per line of the simple.py script I get stuck with :

from socket_wrapper import Socket
Traceback (most recent call last):
  File "<input>", line 1, in <module>
ModuleNotFoundError: No module named 'socket_wrapper'

Not sure if I download this package it will solve the problem.

I use Psychopy Standalone v3.0.0b12 on a macOS High Sierra version 10.13.6

Is there something that I did wrong?

thanks for your help!

Hello Marie,

I worked on connecting EGI NetStation to PsychoPy few months earlier. I believe the socket_wrapper issue arises when you don’t have proper connection setup. I’m not sure what part of the stage you are at, but you need to make sure that:

  1. First all the cables/hardwares are setup properly (connection among PsychoPy computer, amplifier, NetStation computer)
  2. NetStation workbench configuration is setup properly so that it has proper IP and port number to read in
  3. Then, the PsychoPy code and egi module

I made a documentation back then and hope this could be any help.

If you are just beginning to connect PsychoPy to EGI, I think you can start from the beginning of the wiki page. Let me know if you have any questions!

Best,
Jin Jeon

Hey there ,
Thanks for your quick response, and moreover the wiki : I took a look over it and it is great ! I will take a look at your work since I’m also using this experiment for infants and I will be using Tobii pro SDK as well.

The problem about the connection setup is that I can’t change anything since it’s working for other team using the set-up.
Note that my experiment was working perfectly when I was using psychtoolbox.

The only difference of the set up you draw in the wiki is the use of a blackbox connecting two computers (Mac and windows) to the egi computer. All those connection are with Ethernet wires.

Concerning the psychopy, I follow the indications of phschopy itself by installing the Standalone version on my Mac. I didn’t install python 3 before I only have python 2.7 from macOS.

I am actually trying to begin all over again by removing Psychpy3 and install Psychopy2 with the stable version (compare to the beta one) …
So now the script is running without errors BUT nothing is happening on the egi computer (the screen didn’t switch when the ns.Start_Recording() is launch although Psychopy returns “True”).

Do you have any other suggestions?

Hey Marie,

Yes, I also used PsychoPy2 1.90.3. What is the NetStation version of yours? Also, are you saying that your current same setting works on Psychtoolbox but doesn’t work with PsychoPy?

I haven’t used psychtoolbox to connect to EGI Netstation, but I’m assuming the code and configuration could be a little different, which is why it is not currently working. I also had to strip out the ‘black box’ or the ‘sync box’ when I was converting to PsychoPy because that black box was no longer used in the PsychoPy setting. I’m not sure if removing it is necessary though.

As for the connection issue, what was the script that you ran? Did it show any error message?
You can try running pyns_auto.py Link to Github.
This file is like the most basic file that simply connects and automatically sends event labeled as ‘auto’ for the first 1-2 minutes. You can see the instructions at https://github.com/vucml/psychopynetstation/wiki/Sending_Events_and_Timing_Check
If you want to minimize and break the testing to small increments so that you can figure out what stage is causing the issue: you can run pyns_auto.py even without PsychoPy interface if you have PsychoPy installed to your system. You can simply type python -i pyns_auto.py in the terminal.

If this file is not able to send signal, I’m assuming it is likely that either hardware cables or Netstation is not setup properly.

Let me know how it goes, or if you have any questions on the stuff that I just wrote. :slight_smile:

Best,
Jin

Also, it might be a good idea to start a new post instead, and if you do so, you can tag me there :slight_smile:

It works !! I assume it was a problem of Psychopy version ( beta 3 vs 2 v1.90.3). Thanks for your help!

1 Like

My guess is that EGI (pynetstation) isn’t working on Python3 and, so far, I haven’t managed to get the PsychoPy3 release to compile properly on Python2.7

1 Like

@jon Could you help me then i just have a huge headache to deal with versions…

I need to run an experiment using tobii-research (python 2.7 or 3.5) simultaneously with egi (seems python 2.7 as you suggested), and with dynamic variable for sounds and image as well as the best time currency (Psychopy3 python 3.6).

I’ve tried to install python 3.5 through anaconda following the recipe on Psychopy installation webpage. When I try to launch psychopyApp.py (after cd to the psychopy/app/ folder) but I get this error : RuntimeError: shellCall() requires Python 2.7, or 3.6 and newer.

How can I make all those work together? I am adding the condition of wanting to use the psychopy builder.

Thanks for any answer I am truly desperate right now…

@jon seconding. Get

type(1L): ('long', '=l'),  # '=' -- translation is: four bytes

Connecting PsychoPy 3 to NetStation. Message was still received running pyns_auto.py

Any chance this was updated yet for 3.2.3?

No, it hasn’t been updated recently and I’m somewhat limited by not having an EGI system even to test on. It also looks like the company has been bought by Philips (see www.egi.com) so I guess they’re in a period of transition.
I could see what I cna do with an automated conversion to support Python3 but it would be untested.

1 Like

I have limited access to the EGI for the next couple of weeks, but then would work with you to test if you’re game to bounce a bit. I will tweet too, see if any other users may have workarounds, post here if I find any!

@jon @Liberos , I use both EGI and PsychoPy.
If you have some code to test before include to PsychoPy,
message me, and I can test it.

Hello @jon,
We are experiencing the same problem as @Liberos … have there been any developments, by chance, with regards to compatibility between EGI and Pscyhopy 3?
Otherwise, are there any versions of Pscyhopy based on Python 2 in 64-bit for Windows?
Thanks very much to all.

We punted and altered the hardware to be what psychopy needed. We were not able to get PsychoPy to use the input we had on hand.

Hi Jon, I was wondering if the EGI codes for psychopy are updated? I’m getting the same error as above. I have access to EGI system and can test the codes for you. Thank you.