Skip to content

Error when loading Python .so (Linux) #29

@RoyVII

Description

@RoyVII

Hi everybody,

First of all, thank you very much for this plugin, is really useful!

I'm having some trouble when using the PythonPlugin to load a compiled Python code .so file. I get the following output

Python Filter updating settings.
Python Filter setting num outputs to 0
Python event channel created
init function is: PyInit_test
loaded pluginStartup 
 
 
 Traceback (most recent call last):
  File "__init__.pxd", line 164, in init test
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 0x7febdc3e8630> returned a result with an error set
Exception ignored in: 'test.pluginStartup'
SystemError: <built-in method write of _io.TextIOWrapper object at 0x7febdc3e8630> returned a result with an error set
NameError: name 'pluginOp' is not defined
Exception ignored in: 'test.getParamNum'
NameError: name 'pluginOp' is not defined
NameError: name 'pluginOp' is not defined
Exception ignored in: 'test.getParamConfig'
NameError: name 'pluginOp' is not defined

I'm using the code from the new_cmake_build branch and had no problem compiling the plugin. I'm also using an Anaconda environment with Python 3.6, Numpy 1.18.1 and Cython 0.28.2 and setting export CONDA_HOME=/home/anaconda3/envs/oeEnv. This is part of the CMake output:

-- Found PythonInterp: /home/anaconda3/envs/oeEnv/bin/python (found version "3.6.10") 
-- Found PythonLibs: /home/anaconda3/envs/oeEnv/lib/libpython3.6m.so (found version "3.6.10") 
-- Python home: /home/anaconda3/envs/oeEnv
-- Python executable: /home/anaconda3/envs/oeEnv/bin/python
-- Python library: /home/anaconda3/envs/oeEnv/lib/libpython3.6m.so
-- Python lib dir: /home/anaconda3/envs/oeEnv/lib
-- Python include dir: /home/anaconda3/envs/oeEnv/include/python3.6m

The Python module that I'm trying to load is just the template. I get the deprecated numpy warning when compiling but that's all.

I understand that the problem is related to the plugin not using the right environment so it does not find numpy, but I have oeEnv activated when launching Open Ephys and have even used conda run -n oeEnv ./open-ephys to be sure. If I add the following lines to the PythonPlugin::SetFile function

std::cout << "Python version " << PY_MAJOR_VERSION << "." << PY_MINOR_VERSION << " ";
system("python -c \"import numpy; print('Numpy version', numpy.version.version)\"");

the output is

Python Filter updating settings.
Python Filter setting num outputs to 0
Python event channel created
init function is: PyInit_test
Numpy version 1.18.1
Python version 3.6 loaded pluginStartup

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

so I don't really get what is going on.

Do you have any idea of what might be causing this?
Thank you very much!

Rodrigo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions