NeuroNetMem / PythonPlugin

A plugin for open-ephys enabling the insertion of Cython into the open-ephys signal chain.
11 stars 17 forks source link

WHere the official PythonPlugin #25

Open samuelgarcia opened 4 years ago

samuelgarcia commented 4 years ago

Hi all, @fpbattaglia

Thank you for this plugin.

I am totally new in open-ephys plugin and new to this plugin. I am trying to connect my real time spike sorting engine (tridesclous) to open-ephys.

Sorry for basic questions.

  1. Where is the official place for this PythonPlugin just here or there. It is strange because issues are here but master is more recent in repo openephys-plugins

  2. python setup.py build_ext --inplace do not work because of path stuff the source path is supposed to be "../../PythonPlugin" but in fact in should "../../Source" This must be link to a "config.py" but I can't find it.

  3. I don't use conda but pip+virtualenv. Is it a problem ?I guess no.

  4. There is a "Utils/build-linux.sh" file, could you confrim that it is useless with the CMake new apprroach .

Could you help me ? The main tips would be which repo and which branch is working.

Thanks a lot.

Samuel

samuelgarcia commented 4 years ago

Anwser to myself for 2.

There is a hidden file 'python_modules/.config.py' in which is wrong PYTHON_PLUGIN_SRC_DIR = "../../PythonPlugin" must be changed with PYTHON_PLUGIN_SRC_DIR = "../../Source"

samuelgarcia commented 4 years ago

I wanty to contribute, where is the good place repo ?

https://github.com/NeuroNetMem/PythonPlugin or https://github.com/open-ephys-plugins/PythonPlugin

Claybarn commented 4 years ago

Hey @samuelgarcia,

The NeuroNetMem repository is the original while the open-ephys-plugins repository is more of an official adoption of the plugin. It looks like the open-ephys-plugins version has been cleaned up to work with cmake, but perhaps someone else can confirm this. Assuming you are working with a recent version of open-ephys, I would recommend working with the open-ephys-plugins version.

In the past, I most certainly would have recommended using anaconda over pip+virtualenv as any deviation from the instructions typically resulted in multiple compilation issues. That being said, cmake might have cleaned up those issues. Give your pip+virtualenv setup a try with the open-ephys-plugins version and feel free to post any errors you run into here.

If you are interested in contributing your python plugins, that would be warmly welcomed! We currently do not have a proper space for them. I don't think we should add them to the python plugin repository as that could add significant overhead to users. Probably best to make a PythonPlugin-Plugins account where they can all be stored. That is something I can do. When it is setup I will let you know. If you meant making changes to the C++ python plugin source code, I think we should get this repository up to date and then make changes here. Let me know if that's what you meant and I can look into it.

samuelgarcia commented 4 years ago

Thanks you for the answer. I clone from open-ephys-plugins and the cmake stuff works. The c++ module itself compile quite easly. The main problem is this hidden ".config.py" file that have the wrong path.

I think you should synchronize the master branch of the 2 repo very soon!!! Remove PR here or there.

I was able to compile my first test of python plugin but but in the GUI I can select the plugin (it works) when I start the grabbing the erros bar say "no plugin selected". Help would b eappreciate here :)

My contribution would be:

So very little stuff at the moment. i won't inspect the C++ wrapper at the moment. The work is already amazing.

About proposing python plugin themself it is a bit early for me. But yes if I have something relevant (like real time spike sorting with tridesclous), I would be happy to put it somewhere.

So if there is somewhere a PythonPlugin-Plugins repo I can help.

samuelgarcia commented 4 years ago

You can see here https://github.com/open-ephys-plugins/PythonPlugin/commits/master

Pavel Kulik and Anjal Doshi made some change for cmake.

samuelgarcia commented 4 years ago

Looking at this https://github.com/NeuroNetMem/PythonPlugin/network/members it appears that more people are using the repo here and not the open-ephys-plugins

The work of cmake from open-ephys-plugins have NOT been merge here.

Would you be OK if I make a PR here from there work ? At least to synchronize. Having cmake work will make life easier for beginner like me. Mainly because the official way of building a pluging is cmake based.

samuelgarcia commented 4 years ago

I discover that the branch NeuroNetMem/cmake_build have nothing to do with the open-pehys-plugin/master. I think you are trying to fix the cmake stuff in bith side. I went for open-pehys-plugin/master which is a bad choice I think if if it is obvious for a beginner to go there.

Do you plan to merge the cmake_build in the master ? You should because it is more easy for a beginner to have a working master. I also see that the folder hierachy in that branch to not match convention in open-ephys GUI. Could I help to organize ?

samuelgarcia commented 4 years ago

With the branch NeuroNetMem/cmake_build I am able to compile the c++ plugin and one dumy python plugin.

but the ./open-ehys fail on startup.

My guess is that PYTHONHOME is not settle corrrectly.

I have this

Loading Plugin: PythonPlugin... setting PYTHONHOME
PYTHONHOME: 
PYTHONPATH: 
PYTHON VERSION: 2.7.17 (default, Apr 15 2020, 17:20:14) 
[GCC 7.5.0]

I am supposed to have py37 from my virtualenv do you when/where this PYTHONENV is done ? Is it when building c++ ?

EDIT : My bad : I compile outsitde the virtualenv. Sorry.

samuelgarcia commented 4 years ago

Sorry for this long list of errors: I have this at oe startup

Loading Plugin: PythonPlugin... setting PYTHONHOME
PYTHONHOME: 
PYTHONPATH: 
PYTHON VERSION: 3.7.5 (default, Nov  7 2019, 10:50:52) 
[GCC 8.3.0]
__main__:1: DeprecationWarning: sys.getcheckinterval() and sys.setcheckinterval() are deprecated.  Use sys.setswitchinterval() instead.
0x55b9956868e0
3.7.5 (default, Nov  7 2019, 10:50:52) 
[GCC 8.3.0]
Loaded with 3 plugins

And this went I press "play" button and the GUI tell me "plugin not ready"

Traceback (most recent call last):
  File "__init__.pxd", line 164, in init TestTDC
ModuleNotFoundError: No module named 'numpy'

The above exception was the direct cause of the following exception:

SystemError: <built-in method write of _io.TextIOWrapper object at 0x7efc8d737d70> returned a result with an error set
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "__init__.pxd", line 164, in init TestTDC
ModuleNotFoundError: No module named 'numpy'

I suspect that that the PythonPlugin use the wring python env because there is no "numpy" and so many method do not succed on C++ side. (this is why the plugin is not ready).

Any idea how to fix this PYTHONHOME or python env ?

samuelgarcia commented 4 years ago

Anwser to myself:

In the branch NeuroNetMem/cmake_build, the actual CMakeList.txt rely on an environ variable CONDA_HOME which do not exists in pip+virtualenv.

This CONDA_HOME is then copied into PYTHON_HOME.

So doing export CONDA_HOME=/path/to/py/env before the cmake fix the problem.

In case CONDA_HOME is null, maybe we could do that with something like: echo $VIRTUAL_ENV no ?

fpbattaglia commented 4 years ago

We’d like to check whether that still works with conda as that would remain the preferred method

Thanks Francesco On 15 May 2020, 14:23 +0200, Garcia Samuel notifications@github.com, wrote:

Anwser to myself: In the branch NeuroNetMem/cmake_build, the actual CMakeList.txt rely on an environ variable CONDA_HOME which do not exists in pip+virtualenv. This CONDA_HOME is then copied into PYTHON_HOME. So doing export CONDA_HOME=/path/to/py/env before the cmake fix the problem. In case CONDA_HOME is null, maybe we could do that with something like: echo $VIRTUAL_ENV no ? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

samuelgarcia commented 4 years ago

And about merging the cmake_build into master ?

Claybarn commented 4 years ago

@samuelgarcia what operating system are you on? I spoke with the people over at open ephys and they said the python plugin at open-ephys-plugins is working for linux and Mac. You do have to use anaconda, however.

fpbattaglia commented 4 years ago

Windows was working too last time I checked

cheers, Francesco On 15 May 2020, 15:21 +0200, Clayton Barnes notifications@github.com, wrote:

@samuelgarcia what operating system are you on? I spoke with the people over at open ephys and they said the python plugin at open-ephys-plugins is working for linux and Mac. You do have to use anaconda, however. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

samuelgarcia commented 4 years ago

I am on ubuntu 18.04 now.

I am now able to run some basic test with pip+virtualenvwrapper

pip+virtualenvwrapper is important to me on linux. I use conda only on windows or apple but never on linux.

Thank you very much for help.

Yes the version of open-ephys-plugins is working but it diverge from your cmake_build branch. (Except that the hidden .config.py file is wrong and prevent plugini to run)

They should not have a divergent version in there master this is very confusing.

I would higly advice:

So official PR and folder organisation would be here. Be aware that documentation for beginers (I am) is based on cmake stuff in OE wiki.