-
Notifications
You must be signed in to change notification settings - Fork 47
Description
I'm using Anaconda as my python distribution (on a Mac). When I try to compile rwt on my system against Anaconda, I get an error as shown in the title of this issue. There are possibly three reasons for this:
- The cmake cache variables PYTHON_LIBRARY and PYTHON_INCLUDE_DIR are not properly set. I think these should be explicitly set using the cmake -D flag; there is maybe another way of doing this?
- The filesystem path to the dynamic library _rwt.so is not properly set, even if PYTHON_LIBRARY and PYTHON_INCLUDE_DIR are properly set. This is can be fixed using the install_name_tool command with the parameter -change.
- I'm using a more recent version of numpy (1.9.2). It seems that the numpy swig configuration file that is in rwt is for version 1.7 (I could be incorrect).
Below are information that shows the problem and the fix. If a user, like me, wants to install rwt alongside Anaconda, could you add instructions in the documentation to show how it can be done?
SHOWING SYSTEM INFORMATION
uname -a Darwin hostname 14.4.0 Darwin Kernel Version 14.4.0: Datetime 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
printenvTERM_PROGRAM=Apple_Terminal
TERM=xterm-256color
SHELL=/bin/bash
TMPDIR=/var/folders/jp/bbbjnpys6n1dsbpw8wtm9bxh0000gp/T/
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.b0806cvhV9/Render
TERM_PROGRAM_VERSION=343.7
OLDPWD=$HOME/Temp
TERM_SESSION_ID=BC756C22-A12E-4817-847B-913DFB4F5FAE
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.3QWtJEqlQO/Listeners
__CF_USER_TEXT_ENCODING=0x1F6:0x0:0x0
PATH=$HOME/Apps/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/texbin
PWD=$HOME/Temp/rwt/python
EDITOR=mate
LANG=en_US.UTF-8
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
SHLVL=1
DISPLAY=/private/tmp/com.apple.launchd.G3vnOgR0aM/org.macosforge.xquartz:0
_=/usr/bin/printenv
conda --versionconda 3.15.1
python -c 'import numpy;print (numpy.version.full_version)'1.9.2
which python$HOME/Apps/anaconda/bin/python
SHOWING THE COMPILER WARNING AND ERROR
svn co https://github.com/ricedsp/rwt/trunk rwt
cd rwt/python
cmake .
make$HOME/Apps/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning:
"Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
warning "Using deprecated NumPy API, disable it by " \
^
1 warning generated.
[ 37%] Building C object CMakeFiles/_rwt.dir/Users/willemm/Temp/rwt/lib/src/dwt.c.o
[ 50%] Building C object CMakeFiles/_rwt.dir/Users/willemm/Temp/rwt/lib/src/idwt.c.o
[ 62%] Building C object CMakeFiles/_rwt.dir/Users/willemm/Temp/rwt/lib/src/rdwt.c.o
[ 75%] Building C object CMakeFiles/_rwt.dir/Users/willemm/Temp/rwt/lib/src/irdwt.c.o
[ 87%] Building C object CMakeFiles/_rwt.dir/Users/willemm/Temp/rwt/lib/src/platform.c.o
[100%] Building C object CMakeFiles/_rwt.dir/Users/willemm/Temp/rwt/lib/src/init.c.o
Linking CXX shared module _rwt.so
make install
python -c 'import rwt'Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6
SHOWING THE FIX TO BOTH THE COMPILER WARNING AND ERROR
make clean
Get most recent copy of numpy SWIG configuration file. Download numpy-1.9.2 source file to
home directory
cp $HOME/numpy-1.9.2/tools/swig/numpy.i .
cmake -D PYTHON_LIBRARY=$HOME/Apps/anaconda/lib/libpython2.7.dylib -D PYTHON_INCLUDE_DIR=$HOME/Apps/anaconda/include/python2.7 .
make
otool -L _rwt.so _rwt.so:
libpython2.7.dylib (compatibility version 2.7.0, current version 2.7.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
install_name_tool -change libpython2.7.dylib $HOME/Apps/anaconda/lib/libpython2.7.dylib _rwt.so
otool -L _rwt.so _rwt.so:
$HOME/Apps/anaconda/lib/libpython2.7.dylib (compatibility version 2.7.0, current version 2.7.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
make install
python -c 'import rwt'Success