openyou / emokit

Open source driver for accessing raw data from the Emotiv EPOC EEG headset
http://www.openyou.org
Other
521 stars 235 forks source link

OSError: libhidapi-libusb.so.0: cannot open shared object file: No such file or directory #266

Open wangwuqi opened 7 years ago

wangwuqi commented 7 years ago

I install the emokit and run the Usage example code, then it cant work

wuqi@wuqi-VirtualBox:~$ python test.py 
Initializing Emokit...
Initializing Reader Thread...
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/emokit/emotiv.py", line 229, in run
    self.initialize_reader()
  File "/usr/local/lib/python2.7/dist-packages/emokit/emotiv.py", line 133, in initialize_reader
    self.reader = EmotivReader()
  File "/usr/local/lib/python2.7/dist-packages/emokit/reader.py", line 35, in __init__
    hidapi.hid_init()
  File "/usr/local/lib/python2.7/dist-packages/hidapi/hidapi.py", line 413, in hid_init
    __load_hidapi()
  File "/usr/local/lib/python2.7/dist-packages/hidapi/hidapi.py", line 164, in __load_hidapi
    __hidapi = CDLL(__libpath)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 362, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libhidapi-libusb.so.0: cannot open shared object file: No such file or directory
warrenarea commented 7 years ago

i think its related to your libhidapi-libusb.so file.

it looks like you're missing a file related to utilizing the usb. also.... i'm not sure how things will work for you with virtualbox...

you may have to try to hunt down those libhidapi-libusb.so files or find out what library they're from... i suggest a google search of

OSError: libhidapi-libusb.so.0: cannot open shared object file: No such file or directory
warrenarea commented 7 years ago

you may also want to investigate how virtualbox is communicating in regards to the /hidapi/

i think i've had issues with the past using USB stuff in virtualbox, kind of complicates matters.... i remember, you also needed to install an "extended virtualbox" addon as well.

wangwuqi commented 7 years ago

I install emokit on windows10, and run the Usage example code, and the reader just 'stopping, stopped and restart',

Reader stopping...
Reader stopped...
Restarting Reader
Initializing Reader Thread...
wangwuqi commented 7 years ago

well, I find the similar issue 'Reader Thread Keeps Restarting #218'

xribene commented 7 years ago

I had the same issue, until i tried in ubuntu ( not in virtual box) and all hidapi and reader restarting problems were solved

On Tue, Jul 4, 2017 at 9:44 AM, wuqi notifications@github.com wrote:

well, I find the similar issue 'Reader Thread Keeps Restarting #218 https://github.com/openyou/emokit/issues/218'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openyou/emokit/issues/266#issuecomment-312794100, or mute the thread https://github.com/notifications/unsubscribe-auth/APFkn5W-R92aIyXeL0iE-nfgDnMjRza7ks5sKd9kgaJpZM4OMQwb .

warrenarea commented 7 years ago

I think I'll eventually have to setup linux so I can assist with updating the repository, it would be nice to get it working in virtualbox too.. because then it could be an easy switch back and forth from Windows.

At this time though, it doesn't make sense for me to commit my time and mental resources to setting up the OS, and tweaking the scripts settings to get it to work. Makes more sense to continue trying to decipher the workings of these devices, first figuring out how they work before spreading myself over two architectures.

GabrielBioML commented 7 years ago

I had the same problem. I fixed it by changing a line hidapi.py. It's dirty but it works. at line 157 you have the function find_library but it doesn't return the complete path only the name of the library. What I did was to had the rest of the path to the shared library at line 164:

Search for the hidapi library.

    __libpath = find_library('hidapi') or\
                find_library('hidapi-libusb') or\
                find_library('hidapi-hidraw')
print(__libpath)
    if __libpath is None:
        raise RuntimeError('Could not find the hidapi shared library.')

    # Load the hidapi library.
    __hidapi = CDLL(r"/usr/local/lib/{}".format(__libpath))  #this is 164 where I added the rest of the path
    assert __hidapi is not None

hope it helps

warrenarea commented 7 years ago

Also. Epoc+ uses the hidapi product name of 'EEG Signals'

ki9us commented 5 years ago

I don't know anything about this repo or your OS, but on Linux I had this error while trying to run Monero's GUI wallet. I fixed it in Ubuntu with:

sudo apt install libhidapi-libusb0

Other distros probably have a similar package.