BCPy2000 cannot work with Python2.7

Known Issues and Problems with BCI2000
Post Reply
rocz
Posts: 3
Joined: 12 May 2015, 22:43

BCPy2000 cannot work with Python2.7

Post by rocz » 12 May 2015, 23:00

I know that BCPy2000 works perfect with python 2.5 but i need some libraries that does not work in this version, thats why i have to use python 2.7 (at this moment the library dont work either with pyhon 2.6)
I found this http://bci2000.org/phpbb/viewtopic.php?t=994 and try to change "whatever" with "python27" but i get the error "Fatal python error: PyEval_RestoreThread: Null state" and " PythonAppFilter::Constructor: failed to recognize version from dll name "python27".
2015-05-12T21:53:46 - BCI2000 Started
2015-05-12T21:53:46 - PythonAppFilter::Constructor: failed to recognize version from dll name "python27".
2015-05-12T21:53:46 - PythonSrcADC::Constructor: failed to recognize version from dll name "python27".
2015-05-12T21:53:47 - PythonSigFilter::Constructor: failed to recognize version from dll name "python27"."
The python27.dll is in the route C:\Windows\SysWOW64 I guess this is why cannot find it, have i to create/change the PYTHONHOME? and if i have, how i do that?
Hope can help me to do bcpy works in python2.7

jhill
Posts: 34
Joined: 17 Nov 2009, 15:15

Re: BCPy2000 cannot work with Python2.7

Post by jhill » 13 May 2015, 10:30

At the moment BCPy2000 still requires Python 2.5. I have tried to get the old approach (i.e. embed a Python session inside a C++ executable) working with 2.7 but embedded-Python seems to be extremely fragile and difficult-to-tame. The current version can even break if the version of the numpy package is updated. While I would be very happy if someone were able to wrangle the existing PythonFilter.cpp and EmbeddedPythonConsole.py to work with 2.7, I think the future of support for Python and other interpreted languages (including Python 3) will require moving away from embedding altogether, and more towards launching a separate interpreter process and communicating with it over shared memory. I started such a project, with Python 2.x/3.x as the target, but have had to shelve it with no particular end date in sight.

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: BCPy2000 cannot work with Python2.7

Post by boulay » 13 May 2015, 11:39

Jez,

Have you thought about open-sourcing it on github, bitbucket, or something similar? I'm not working with BCI2000 at the moment but I could see myself coming back to this at some point in the future. And I know it's not a good idea to put any effort into this until the next stable version of BCI2000 is released, which I'm told is imminent.

Rocz,

I spent a while trying to get BCPy2000 to work with Python 2.7 and I never got close. If I recall correctly, the libraries that proved to be mutually incompatible with one of BCPy2000-embedded or Python2.7 were pyreadline, pyopengl,PIL, and pygame.

I ended up getting BCPy2000 to work with Python 2.6, and I replaced the default pygame-based renderer with a pyOgre-based renderer. (OGRE3D is an open source 3D engine, and it has an outdated Python wrapper). There is exactly one old version of PyOgre that works with Python 2.6, and that version of Python 2.6 has specific versions of the library dependencies that are compatible with BCPy2000. But honestly, I doubt I could clobber together the correct compatible versions right now. They're probably gone.

Long-story-short, it's not worth it. Your time would be better spent trying to complete Jeremy's shared-memory implementation.

-Chad

rocz
Posts: 3
Joined: 12 May 2015, 22:43

Re: BCPy2000 cannot work with Python2.7

Post by rocz » 14 May 2015, 14:40

Thanks for your answers, I also try to follow the instructions in this page https://github.com/cboulay/BCPyElectrophys as an start. I really wanto to work with python 2.7 and I will continue trying, but I need to finish a project as fast as I can, its posible work with python 2.6, python 2.7 y BCPy2000 in a virtulaenv?

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: BCPy2000 cannot work with Python2.7

Post by boulay » 15 May 2015, 11:25

I think the only way you can get it to work with Python 2.7 is by modifying the embedded Python console in the BCPy2000 modules. This is really difficult to do. In my list of 'incompatible packages', I forgot to mention the one at the heart of it all: IPython. IPython has changed a lot since BCPy2000 was first made. The way it does embedding is entirely different. The packages it depends on have also changed quite a bit. The old versions of these packages, the ones that work with BCPy2000, do not work with Python 2.7.

As you can see in the README of my BCPyElectrophys, I attempted to get it all working with Python 2.7 and I failed. I did get it working with 2.6 though, and that was enough for my needs so I stuck with that. I have tried since to get it working on 2.6 and I couldn't. I was running into problems with VisionEgg or pyopengl, problems that somehow didn't exist on that one laptop where I had this all working. Maybe my instructions are missing a step somewhere.

While it sounds a bit backwards, I think you'll have an easier time trying to find an old version of your library that works with 2.5/2.6 than getting BCPy2000 to work with 2.7. Of course we would all be grateful if you can get BCPy2000 to work with 2.7, but it's a lot of work and ultimately not the right way to do it.

The new way Jeremy was going about it (shared memory) is definitely the better way to do it. Maybe once BCI2000 stabilizes someone (like yourself) might be willing to continue work on it.

rocz
Posts: 3
Joined: 12 May 2015, 22:43

Re: BCPy2000 cannot work with Python2.7

Post by rocz » 15 May 2015, 14:23

Thank you all, for my current proyect I will follow your advices and if at some point I can work with python 2.7 I will let you know.

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests