NeuroTechX / eeg-notebooks_v0.1

Previous version of eeg-notebooks
https://neurotechx.github.io/eeg-notebooks
BSD 3-Clause "New" or "Revised" License
184 stars 56 forks source link

Issues running on Mac #3

Closed jdpigeon closed 4 years ago

jdpigeon commented 6 years ago

This issue will host advanced instructions, common issues, and discussion related to setting up and running EEG notebooks on MAC computers.

Common Issues

  1. Running muse-lsl.py in terminal leads to The command was not found or was not executable: gatttool
  2. Library "c" not found: https://github.com/alexandrebarachant/muse-lsl/issues/63
    • Change directory in import to get ctypes library (see instructions)
kylemath commented 5 years ago

Working through a jupyter notebook for P300 in Python==3.6 , Everything working, connects to muse, Streaming... and then immediately Disconnects. Any ideas?

jdpigeon commented 5 years ago

That's an issue we've encountered a lot before, stemming from the failure of pygatt on OSX to start receiving data once a BLE connection has been opened. Unfortunately, I don't have a solution, but @amandakeasson is the world expert on getting muse-lsl working on Mac.

@amandakeasson, do you know anything that might help?

amandakeasson commented 5 years ago

Hi! Yes, my fork of the eeg-notebooks repo includes instructions for how to get muse-lsl working on Macs (see https://github.com/amandakeasson/eeg-notebooks/blob/master/notebooks/mac_notebook.ipynb).

I'll also make a pull request to add the Mac files to NeurotechX eeg-notebooks.

kylemath commented 5 years ago

thanks Amanda, can you describe in more detail what the differences are, have you changed the muselsl code in some way?

kylemath commented 5 years ago

I know about the version differences and why you are using the different conda environment to run the experiment and data viz, but I am getting stuck on the previous step, the connecting, have you changed that code?

amandakeasson commented 5 years ago

That code has not been changed. A lot of the Mac issues just had to do with certain versions of different packages not working on Macs, and I had to change the process for starting the recordings for the experiment and EEG simultaneously.

If you follow the instructions here https://github.com/amandakeasson/eeg-notebooks/blob/master/mac_instructions_general.docx then hopefully everything will work. We've done tests on multiple Macs and so far we've only had issues with one computer, and in that case the Muse wouldn't connect at all.

kylemath commented 5 years ago

got it, that worked thank you , connected

amandakeasson commented 5 years ago

great to hear!

kylemath commented 5 years ago

hey guys, great code, I made a new cueing task I am going to run with my class, you can find the fork of Amanda's code here:

https://github.com/kylemath/eeg-notebooks

I made a minor change to the mac running script in order to save the files with subject name and session, and pass on subject name and number to the cueing task for the behavioural data file

amandakeasson commented 5 years ago

Hi @kylemath, looks great!

Sabrinanalai commented 5 years ago

I am very new to python, and I currently having the same issue @kylemath had before, it was connected to muse and streaming... but soon got disconnected. When I tried @amandakeasson 's fork, the code failed at image it says that

" Failed building wheel for scikit-learn"

then it went on and poped out

"Failed to build scikit-learn pandas muselsl 1.0.1 has requirement pygatt==3.1.1, but you'll have pygatt 3.2.0 which is incompatible. pytest-xdist 1.28.0 has requirement pytest>=4.4.0, but you'll have pytest 4.0.2 which is incompatible."

I have no idea what happened, can anyone tell me the cause?

jdpigeon commented 5 years ago

That's a rather frustrating but solveable dependency mismatch issue.

First, I'd love to see if the regular eeg notebooks installation process works for you based on muse LSL updates we've made at this point.

If that doesn't work, try removing the muselsl version requirement (@==1.01)

wdkaye commented 4 years ago

I recommend editing requirements_mac.txt and upgrading Pygatt. (I'm upgraded from 3.2.0 to 4.0.5 and I am able to stream successfully)

I followed the instructions, installed the packages via conda, ran the notebook mac-notebook.ipynb, but kept failing at step 1 with no headset connectivity, with error messages like NotConnectedError: No BGAPI compatible device detected

After poking around a little bit I was able to determine that the failure was coming from pygatt. The pygatt github page recommends the following to print debug info:

import pygatt
import logging

logging.basicConfig()
logging.getLogger('pygatt').setLevel(logging.DEBUG)

In my case, this revealed the errors:

DEBUG:pygatt.backends.bgapi.bgapi:Failed to open serial port
...
OSError: [Errno 16] Resource busy

Pygatt's issue page had a section for connectivity issues, ultimately it ends with a "Please upgrade to version 4". This worked for me.

Otherwise thanks a million for providing mac-specific instructions for working with these notebooks, they are tremendously helpful :)