Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin_interface #91

Open
mesca opened this issue Aug 4, 2018 · 17 comments · May be fixed by #121
Open

plugin_interface #91

mesca opened this issue Aug 4, 2018 · 17 comments · May be fixed by #121

Comments

@mesca
Copy link
Contributor

mesca commented Aug 4, 2018

When installing from pip, from openbci import wifi will give an error: ModuleNotFoundError: No module named 'plugin_interface'. It is because plugin_interface.py is outside of the package.

Commenting the line from .plugins import * in openbci/__init__.py fixes the problem. I am not familiar with the plugin system, and maybe this quick fix has side-effects. Is there a better way?

@tushar-c
Copy link

tushar-c commented Aug 14, 2018

I hope somebody responds, I have the same issue.

EDIT: Well, @mesca, I got a temporary solution working, atleast for now. The installer provided in the repo does not seem to install plugin_interfaces. So, here are the steps I did :

  1. Install openbci-python with pip

  2. Clone this repo onto your machine.

  3. Copy the file in the root called 'plugin_interface.py'

  4. Then manually paste it into the plugins folder of the directory where openbci-python is installed. So for me the full path looked like:
    "C:\Users\tushar\AppData\Local\Programs\Python\Python35\Lib\site-packages\OpenBCI_Python-1.0.0-py3.5.egg\openbci\plugins"

  5. In this directory (the 'plugins' directory), open each file, and see the imports, and replace all imports that say import plugin_interface as plugintypes with from . import plugin_interface as plugintypes. Do this with every file in the plugins directory.

  6. Open your terminal (in any directory now), open python, then do from openbci import wifi, it should work. It works for me.

Hope you find this helpful!

@tushar-c
Copy link

If this works for you, please close the issue.

@mesca
Copy link
Contributor Author

mesca commented Aug 14, 2018

Thanks, but your solution and mine are just workarounds, not real fixes. The point is that I don't see the reason for importing ALL the plugins and dependencies in the __init__.py file, when you just need the wifi module.

Anyway, you should probably submit a PR, since at least that makes it useable. Having to manually copying and editing files defeat the purpose of a pip package ;)

@tushar-c
Copy link

I agree that having to manually copy and paste and edit files is definitely not something that the user should have to do. However, I wonder what exactly causes this issue. Is the setup.py not able to do a system-wide install of plugin_interfaces ? If so, then how would we fix that?

@mesca
Copy link
Contributor Author

mesca commented Aug 14, 2018

Well, I think it's because plugin_interface.py is not into the openbci package.

@tushar-c
Copy link

By openbci package, you mean the one install through pip, correct?

@mesca
Copy link
Contributor Author

mesca commented Aug 14, 2018

Yes, but also the normal Python package in the openbci directory (see: https://docs.python.org/3/tutorial/modules.html#packages).

@tushar-c
Copy link

tushar-c commented Aug 14, 2018

Oh, I'm sorry I didn't get you the first time. Anyway, I have submitted a PR. Also, here is a version I made that you can install (still from the .whl file there). So you have to install manually. Here is the link -> https://github.com/tushar-c/openbci-fixed

EDIT: To make sure I'm clear, by manually, I mean you have to download, go to where the .whl file is, then do pip install <package>.

@andrewjaykeller
Copy link

Sounds like we need to add the plugin_interface.py into the package that is published with pypi?

@mesca
Copy link
Contributor Author

mesca commented Oct 17, 2018

Probably :)

@andrewjaykeller
Copy link

any ideas how?

@rivasd
Copy link

rivasd commented Jan 18, 2019

Since this basically breaks the whole package ( I can't even do from openbci import cyton ), I feel like this should be a much higher priority ?

@ChristineZh0u
Copy link

Just going to confirm that this issue is still present as of today after installing with pip install openbci-python. Also had to install pyserial "manually" (even though it's in requirements.txt - has the build on PyPi not been updated for a while or something?)

@rivasd rivasd linked a pull request Apr 23, 2019 that will close this issue
@shaielc
Copy link

shaielc commented Aug 16, 2019

this error occurs on a new install ( fresh vm ubuntu 18.10) same error trying to import anything from the obenbci pkg fails.

@shaielc
Copy link

shaielc commented Aug 16, 2019

upgrading pip and reinstalling did the trick

works fine

@molguin92
Copy link

This is still not working for me, and as @rivasd said higher up in this thread, it breaks the whole package.

$ pip list
Package        Version
-------------- -------
bluepy         1.3.0  
future         0.17.1 
iso8601        0.1.12 
numpy          1.17.2 
OpenBCI-Python 1.0.2  
pip            19.2.3 
pyserial       3.4    
PyYAML         5.1.2  
setuptools     40.8.0 

Running the following code still throws an error:

import sys
from openbci import OpenBCIGanglion

def handle_data(sample):
    logging.debug(sample)

if __name__ == '__main__':
    board = OpenBCIGanglion()
    board.start_streaming(handle_data)
File "{...}/OpenBCIClient/venv/lib/python3.7/site-packages/openbci/plugins/csv_collect.py", line 6, in <module>
    import plugin_interface as plugintypes
ModuleNotFoundError: No module named 'plugin_interface'

@rivasd
Copy link

rivasd commented Sep 24, 2019

@molguin92 I think that OpenBCI_Python is pretty much deprecated at this point, you should try out the pyOpenBCI repo/package instead, It works for bluetooth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants