Using stimfit with Anaconda

164 views
Skip to first unread message

Matt McCabe

unread,
Mar 28, 2017, 11:01:43 AM3/28/17
to stimfit
Hello,

Thanks for making this program freely available! I've been using it for a bit now and find it very intuitive, and the integrated python shell is fantastic.
I really have two core questions. First, does stimfit support any version of python >= 3? And second, can I make the embedded python shell use an anaconda environment by default?

I've been writing some helper functions to make life easier, and I would like to start integrating outside dependencies. I use anaconda to manage virtual environments, and I'm having trouble getting stimfit to use the appropriate environment. 

Below are the solutions I've tried already. Any guidance would be most appreciated!

-Matt
---------------------------------------------------------------------------------------------------------------------------------------------

First off, my OS is Ubuntu 16.04. 

My first thought was to launch stimfit from a terminal within the anaconda environment. This almost works if the environment is a python3.6 environment, as running  >>> sys.executable in the stimfit embedded shell indicates that it is using the correct python binary, but the embedded shell itself indicates it is python version 2.7 in the header. If I launch the binary that sys.executable points to from an outside terminal, the python interpreter says it is version 3.6. Additionally, I am unable to import the packages I know to be present in the environment.

My second thought was to do the same as before, but using a python2.7 environment. Launching from the terminal fails with the error message "ImportError: No module named wxversion". If I install wxPython using conda or pip, it tells me the version it fails with the error "Fatal Error: Mismatch between the program and library build versions detected." I assume this is because the version from the NeuroDebian repo is built with wxPython 3.0.2, whereas the only versions available from conda or pip are 3.0.0 and 2.9.1 respectively. 

My third thought was to build from source using ./configure PYTHON=$HOME/path/to/conda/env/python --enable-python as described in the build guide. `./configure` works fine when building against the python3.6 environment, but `make` fails with error
"In file included from ../../../../src/stimfit/./gui/app.cpp:51:0:
../../../../src/stimfit/./gui/./app.h:208:34: fatal error: wx/wxPython/wxpy_api.h: No such file or directory
 #include <wx/wxPython/wxpy_api.h>
I looked for wx packages in aptitude and found that libwxgtk3.0 and python-wxgtk3.0 are installed by default on Ubuntu 16.04, and I installed libwxgtk3.0-dev and python-wxgtk3.0-dev myself. But this still produced the same error.

And building against the python2.7 environment works, but launching stimfit fails with error 
Fatal Error: Mismatch between the program and library build versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1009,wx containers,compatible with 2.8),
and wxNet used 3.0 (UTF-8,compiler with C++ ABI 1002,wx containers,compatible with 2.8).
Aborted (core dumped)

Based on the error message the python2.7 build fails because it builds using wxgtk3.0, but something in the program is only compatible with wx2.8? Which led me to wonder how it is that the NeuroDebian version indicates it is using 3.0.2?
I'm also not entirely sure why the 3.6 build fails, but I assume the root of the issue is that either wx or stimfit does not support python3.6? Instead of iterating backward through python versions in hopes that one will work, I thought it would be better to just ask!
---------------------------------------------------------------------------------------------------------------------------------------------------

Again, any advice you have for how to proceed would be greatly appreciated!

Christoph Schmidt-Hieber

unread,
Mar 28, 2017, 11:21:09 AM3/28/17
to sti...@googlegroups.com
Hi Matt,

Thanks for using stimfit.

Unfortunately you cannot build stimfit with Python 3. The main issue is that the embedded Python shell (which is part of wxPython) hasn’t been ported to the version of wxPython that is compatible with Python 3 yet.

Any version of Python 2.7 on GNU/Linux should be fine though. My guess is that you have different versions of wxgtk installed, one that comes with Anaconda and another one that comes with your system.

Not sure where to start debugging this - you could look into config.log to see which version of wx-config is used, or run ldd on the libraries and the program executable to see which wx libraries exactly are linked.

In general you should be able to get all build dependencies by running sudo apt-get build-dep stimfit

Christoph
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "stimfit" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stimfit+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Matt McCabe

unread,
Mar 29, 2017, 10:03:44 AM3/29/17
to stimfit
Thanks for the quick response Christoph!

That's what I was afraid of. I did quite a bit of googling to see if PyCrust was compatible with Python3 with no luck. Looking at the stimfit source code I found a few comments referencing preparations for python 3 and wxPython Phoenix, so I was hopeful that maybe I was missing something. 

Looking back to earlier questions, I saw that you already suggested a workaround using sys.path.append(). That's working for me at the moment, though I'd like to find a more elegant solution. I'll have a look at the config.log and if I make any progress I'll be sure to post here again to update anyone having similar problems.

Thanks for your help!
-Matt
Reply all
Reply to author
Forward
0 new messages