c - NameError with Python Swig trying to interface the cholmod library -
i'm trying create python interface c cholmod library, part of suitesparse library (suitesparse).
as i'm new swig, don't know if daunting task or not. didn't find reference interface done in swig.
compiling happens without trouble.
this error when try import swig-generated "_cholmod.py" file:
python 2.7.5+ (default, feb 27 2014, 19:37:08) [gcc 4.8.1] on linux2 type "help", "copyright", "credits" or "license" more information. >>> import _cholmod traceback (most recent call last): file "<stdin>", line 1, in <module> file "_cholmod.py", line 99, in <module> class suitesparse_config_struct(_object): file "_cholmod.py", line 106, in suitesparse_config_struct __swig_setmethods__["malloc_func"] = __cholmod.suitesparse_config_struct_malloc_func_set nameerror: name '_suitesparse_config_struct__cholmod' not defined
where name defined? quick grep doesn't return before try import extension after try import it:
grep -r -n _suitesparse_config_struct__cholmod * binary file _cholmod.pyc matches
i'm using:
- swig version 3.0.5 compiled g++ [x86_64-unknown-linux-gnu] configured options: +pcre
- cholmod library suitesparse 4.4.3
here minimal example:
file setup.py:
from distutils.core import setup, extension module1 = extension('__cholmod', sources=['cholmod.i'], libraries=['cholmod', 'suitesparseconfig', 'blas', 'amd'], library_dirs=['/home/nikolaj/documents/work/dominique/suitesparse 4.4.1-1_archlinux/suitesparse-4.4.1-1-x86_64.pkg/usr/lib/'], include_dirs=['/home/nikolaj/documents/work/dominique/suitesparse 4.4.1-1_archlinux/suitesparse-4.4.1-1-x86_64.pkg/usr/include/'], swig_opts=['-i/home/nikolaj/documents/work/dominique/suitesparse 4.4.1-1_archlinux/suitesparse-4.4.1-1-x86_64.pkg/usr/include/']) setup(name='_cholmod', version='0.1', ext_modules=[module1])
and invoke this:
python setup.py build_ext --inplace
file cholmod.i:
/* -*- c -*- */ #ifdef swigpython %module _cholmod %{ #define swig_file_with_init #include "suitesparse_config.h" #include "cholmod_config.h" #include "cholmod_core.h" #include "numpy/arrayobject.h" %} %feature("autodoc", "1"); %init %{ import_array(); %} %include "suitesparse_config.h %include "cholmod_config.h" %include "cholmod_core.h" #endif
i suspect there problem typedef , c struct after reading on , on tutorials, official documentation, presentations don't know i'm missing.
could me here? lot!
Comments
Post a Comment