Using BTK Python Wrapper with Different Python Instances

22 views
Skip to first unread message

slbarton

unread,
Feb 26, 2015, 4:49:50 PM2/26/15
to btk-...@googlegroups.com
Hi all. New user of this package (and a novice at building from source/trouble-shooting installation issues) and I'm having some trouble getting it to run in any version of python that is not my system default version. First, my system background...

-- Early 2011 13" MacBook Pro running OS X 10.10.1 Yosemite
-- System Default Python (/usr/bin/python) : python 2.7.6
-- Anaconda Scientific Distribution of Python 2.1.0 (~/anaconda/bin/python) : python 2.7.9, SWIG 3.0.2, Numpy 1.9.1
-- The anaconda dist. of python is currently set to my default python under my .bash_profile

I use the Anaconda python distribution for data analysis in order to keep all my packages and code tidy. I followed the followed the installation and build instructions for BTK provided on the main wiki. When I import BTK using my system default python with...

>>> import sys
>>> sys.path.append('/Path/To/Folder containing btk.py')
>>> import btk

... the package imports just fine. However, when I go to import it using the anaconda distribution of python, I get the following error...

Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6

From the research I did on this error, I thought it was a problem with CMake and SWIG linking to the default python during the build process, preventing the final code from running under a different instance of python. I discarded the old build, rebuilt with CMake, this time manually specifying values for variable that seemed to be related to using a particular instance of python. I reset the following variables to point to the appropriate location of my desired python files in the anaconda distribution...

PYTHON_EXECUTABLE
PYTHON_INCLUDE_DIR
PYTHON_LIBRARY
SWIG_DIR
SWIG_EXECUTABLE
SWIG_VERSION

After reconfiguring with the appropriate files and paths for these variables, the CMake output appeared to reflect my desire to use the anaconda distribution of python, rather than the system default. It even found the appropriate version of Numpy (in the anaconda distribution) without me having to specify it. Running 'make' after this went just fine, and (using the verbose output), everything looked like it was linking appropriately. However, when I tried again to import BTK under the anaconda distribution, I got the same error. Interestingly, I can still import BTK with my system default python just fine.

Can anyone provide any help with this or information on how to import BTK under a different instance of python? Thanks a lot.

(P.S. I did also try the Python Binaries, and ran into the same issue)
Reply all
Reply to author
Forward
0 new messages