NeuroNetMem / PythonPlugin

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

Build Error Xcode #21

Open crcali opened 5 years ago

crcali commented 5 years ago

Good evening,

I am attempting to build the Xcode project, but am running into the following errors:

  1. /usr/PythonPlugin/Builds/MacOSX/Config/get_depends.sh: line 5: activate: No such file or directory
  2. Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
  3. 'EditorHeaders.h' file not found

I have installed the Xcode Command Line tool.

Do you know why this may be occurring? I am attempting to use the Python Filter tab on the Open Ephys GUI.

Thanks in advance. Best, Christopher

Claybarn commented 5 years ago

Hey Christopher.

get_depends.sh is expecting there to be a virtual environment named 'oeEnv'. If you have anaconda installed, you can accomplish this by conda create -n oeEnv python=3.6 cython=0.28.2 This will create a virtual environment with versions of python and cython that work with this plugin. I am realizing in the documentation we say that we recommend using a virtual environment instead of saying it is required. My apologies! See if that cleans up your issues.

crcali commented 5 years ago

Hello,

Thank you very much for your prompt response! I was able to compile the PythonPlugin such that a .bundle file is created. However, after moving it to the PlugIns within my open_ephys application files, the PythonPlugin is not part of the filters. Do you know how to resolve this?

Also, I have a hypothetical question regarding the PythonPlugin. Would I be able to use this in conjunction with a Python script for real time processing of the stream of electrode data?

Thanks again for your help. Best, Christopher

Claybarn commented 5 years ago

I believe the .bundle should already be in the right place! No movement is necessary.

And to answer your question, absolutely! The n_arr variable of the bufferfunction is the electrode data.

crcali commented 5 years ago

Thank you. It seems like this will do exactly as I had hoped!

In terms of the .bundle file, I have it in my /open-ephys/Contents/PlugIns directory. However, after restarting and opening the open_ephys application, the PythonPlugin is not an option, as shown in the following screenshots.

PythonPlugin_Screenshot#1 PythonPlugin_Screenshot#2

Do you know why this may be occurring?

Thanks again for your help. It is greatly appreciated.

Best, Christopher

Claybarn commented 5 years ago

There is probably an error code that is being printed out that would be helpful. With open ephys up and running and Xcode running, is there some text in the bottom right corner? In there it might say something like “dll error loading PythonPlugin”. The text after that should help us figure out what is going on.

crcali commented 5 years ago

I seem to be running into another issue when building. I am getting the following error: ld: library not found for -l-l clang: error: linker command failed with exit code 1 (use -v to see invocation)

PythonPlugin_Screenshot#3

As you can see, I am running the Xcode project in a virtual environment. Do you know what may be causing this issue?

Thanks again, Christopher

Claybarn commented 5 years ago

You said you moved the bundle right? Thinking it can't find it. Can check to see if that is the problem by attempting to navigate to the path found below "The following build commands failed: " in your image.

crcali commented 5 years ago

The bundle is in the open-ephys.app, so I don't believe that is the issue. I have tried a number of things, including a fresh reinstall, and still have not been able to determine the issue.

Thanks again for all your help! Christopher

fpbattaglia commented 5 years ago

it looks like some setting for linking libraries is somehow not set. in the compilation command there's twice in a row "-l -l" but no library is specified (eg -lPython3.6) so the linker interprets the second "-l" as a library that obviously doesn't exist, hence the error... Here is how it looks like for me

Ld /Users/fpbatta/src/PythonPlugin/build/Debug/open-ephys.app/Contents/PlugIns/PythonPlugin.bundle/Contents/MacOS/PythonPlugin normal x86_64 (in target: PythonPlugin) cd /Users/fpbatta/src/PythonPlugin/Builds/MacOSX export MACOSX_DEPLOYMENT_TARGET=10.12 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -L/Users/fpbatta/src/PythonPlugin/build/Debug/open-ephys.app/Contents/PlugIns -F/Users/fpbatta/src/PythonPlugin/build/Debug/open-ephys.app/Contents/PlugIns -filelist /Users/fpbatta/Library/Developer/Xcode/DerivedData/PythonPlugin-gfjhfwatakjmweahsivcqgdzuyos/Build/Intermediates.noindex/PythonPlugin.build/Debug/PythonPlugin.build/Objects-normal/x86_64/PythonPlugin.LinkFileList -Xlinker -rpath -Xlinker /usr/local/anaconda/envs/oeEnv/lib -mmacosx-version-min=10.12 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/fpbatta/Library/Developer/Xcode/DerivedData/PythonPlugin-gfjhfwatakjmweahsivcqgdzuyos/Build/Intermediates.noindex/PythonPlugin.build/Debug/PythonPlugin.build/Objects-normal/x86_64/PythonPlugin_lto.o -Xlinker -export_dynamic -stdlib=libc++ -lpython3.6m -lpython3.6m -undefined dynamic_lookup -undefined dynamic_lookup -L/usr/local/anaconda/envs/oeEnv/lib -undefined dynamic_lookup -undefined dynamic_lookup -L/usr/local/anaconda/envs/oeEnv/lib -bundle -undefined dynamic_lookup -Xlinker -dependency_info -Xlinker /Users/fpbatta/Library/Developer/Xcode/DerivedData/PythonPlugin-gfjhfwatakjmweahsivcqgdzuyos/Build/Intermediates.noindex/PythonPlugin.build/Debug/PythonPlugin.build/Objects-normal/x86_64/PythonPlugin_dependency_info.dat -o /Users/fpbatta/src/PythonPlugin/build/Debug/open-ephys.app/Contents/PlugIns/PythonPlugin.bundle/Contents/MacOS/PythonPlugin I think the PYTHON_VERSION somehow is not substituted so you may need to rerun get-depends.sh?

jsiegle commented 5 years ago

I'm also having issues getting the plugin to load on macOS (version 10.12).

It's giving the following error when trying to load the PythonPlugin:

Loading Plugin: PythonPlugin... 2019-06-18 14:24:11.800747-0700 open-ephys[47560:2238460] Error loading /Users/Josh/GitHub/plugin-GUI/Builds/MacOSX/build/Debug/open-ephys.app/Contents/PlugIns/PythonPlugin.bundle/Contents/MacOS/PythonPlugin:  dlopen(/Users/Josh/GitHub/plugin-GUI/Builds/MacOSX/build/Debug/open-ephys.app/Contents/PlugIns/PythonPlugin.bundle/Contents/MacOS/PythonPlugin, 262): Symbol not found: _PyEval_InitThreads
  Referenced from: /Users/Josh/GitHub/plugin-GUI/Builds/MacOSX/build/Debug/open-ephys.app/Contents/PlugIns/PythonPlugin.bundle/Contents/MacOS/PythonPlugin
  Expected in: flat namespace
 in /Users/Josh/GitHub/plugin-GUI/Builds/MacOSX/build/Debug/open-ephys.app/Contents/PlugIns/PythonPlugin.bundle/Contents/MacOS/PythonPlugin
/Users/Josh/GitHub/plugin-GUI/Source/Processors/PluginManager/PluginManager.cpp:194: Failed to load function 'getLibInfo'
 DLL Load FAILED

Any idea about what's going on?

Claybarn commented 5 years ago

Hmm have been a good amount of changes to the plugin recently. Will check to see if one of them caused it.

Claybarn commented 5 years ago

@crcali and @jsiegle navigate to the Config directory (PythonPlugin/Builds/MacOSX/Config) and run bash get-depends.sh Let me know what you get as the output. I get: /Users/ClaytonBarnes/anaconda3/envs/oeEnv python3.6m You might get an error about line 23 but that's okay.

@crcali it seems the detection script isn't finding any version of python. I don't know if running the build from the command line would prevent the detection script from running? Could try to build with the Xcode GUI and see if that works.

@jsiegle it seems it isn't linking with the static python library. Are you using anaconda? Did you create a virtual environment?

crcali commented 5 years ago

Hi,

Thank you for your ideas! I have attempted to run it from the Xcode GUI as well, but it also doesn't build properly.

When I run the bash command, I get the following output, along with the line 23 error: /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7

Do you know what may be causing this?

Thanks! Christopher

Claybarn commented 5 years ago

Have you installed anaconda? It is trying to use the version of python that comes with the mac which is not supported.

jsiegle commented 5 years ago

get_depends.sh is printing out //anaconda/envs/py36 as the $PYTHON_DIR variable. However, the PYTHON_DIR seems correct in Plugin.xconfig (//anaconda/envs/oeEnv)

I did have to change #include <Python.h> to #include <Python/Python.h> to get PythonPlugin.h to compile, so it makes sense that might be picking up the system Python instead.

Where do we expect Python.h to be found? Somewhere in the Anaconda environment directory?

Claybarn commented 5 years ago

I believe it is in `anaconda3/envs/oeEnv/include/python3.6m'. What is your PYTHON_VERSION variable?

jsiegle commented 5 years ago

python3.6m

jsiegle commented 5 years ago

It now compiles normally if I add /anaconda/envs/oeEnv/include/python3.6m to the list of header search paths, but it's still failing with the same error.

Claybarn commented 5 years ago

Yeah linking python can be a nightmare, which is why the detection script is so great. Wonder if there is a difference in your file structure that is preventing proper linking. @fpbattaglia made the script, perhaps he could help out?

fpbattaglia commented 5 years ago

@jsiegle, it does look like it is somehow still pointing at the system python or in any case not to the anaconda virtual env, because Python.h is directly under ...envs/oeEnv/include/python3.6m and there's no Python directory there. Currently, in get_depends I source ~/.bash_profile to get the PATH env variable, so could it be that there you are not pointing to the anaconda folder (which means you can't activate the virtual environment?)