'SWIG_exception' was not declared in this scope

Asked by Paul Constantine

I'm getting the following error running the navier-stokes demo.

I have dolfin 1.1, ffc 1.1, fiat 1.1, instant 1.1, ufc 2.1.

$ python demo_navier-stokes.py
Calling FFC just-in-time (JIT) compiler, this may take some time.
In instant.recompile: The module did not compile, see '/home/paulcon/.instant/error/a096a21db40e01afea745c6672c67d6bbbe1d377/compile.log'
Traceback (most recent call last):
  File "demo_navier-stokes.py", line 37, in <module>
    V = VectorFunctionSpace(mesh, "CG", 2)
  File "/usr/local/lib64/python2.6/site-packages/dolfin/functions/functionspace.py", line 533, in __init__
    FunctionSpaceBase.__init__(self, mesh, element)
  File "/usr/local/lib64/python2.6/site-packages/dolfin/functions/functionspace.py", line 78, in __init__
    ufc_element, ufc_dofmap = jit(self._ufl_element)
  File "/usr/local/lib64/python2.6/site-packages/dolfin/compilemodules/jit.py", line 66, in mpi_jit
    return local_jit(*args, **kwargs)
  File "/usr/local/lib64/python2.6/site-packages/dolfin/compilemodules/jit.py", line 154, in jit
    return jit_compile(form, parameters=p, common_cell=common_cell)
  File "/usr/lib/python2.6/site-packages/ffc/jitcompiler.py", line 71, in jit
    return jit_element(ufl_object, parameters)
  File "/usr/lib/python2.6/site-packages/ffc/jitcompiler.py", line 177, in jit_element
    compiled_form, module, form_data, prefix = jit_form(form, parameters)
  File "/usr/lib/python2.6/site-packages/ffc/jitcompiler.py", line 145, in jit_form
    cache_dir = cache_dir)
  File "/usr/local/lib64/python2.6/site-packages/ufc_utils/build.py", line 73, in build_ufc_module
    **kwargs)
  File "/usr/lib/python2.6/site-packages/instant/build.py", line 482, in build_module
    recompile(modulename, module_path, setup_name, new_compilation_checksum)
  File "/usr/lib/python2.6/site-packages/instant/build.py", line 105, in recompile
    "compile, see '%s'" % compile_log_filename_dest)
  File "/usr/lib/python2.6/site-packages/instant/output.py", line 49, in instant_error
    raise RuntimeError(text)
RuntimeError: In instant.recompile: The module did not compile, see '/home/paulcon/.instant/error/a096a21db40e01afea745c6672c67d6bbbe1d377/compile.log'

----

$ cat compile.log
running build_ext
building '_a096a21db40e01afea745c6672c67d6bbbe1d377' extension
creating build
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/local/include -I/usr/local/include -I/usr/include/python2.6 -c a096a21db40e01afea745c6672c67d6bbbe1d377_wrap.cxx -o build/temp.linux-x86_64-2.6/a096a21db40e01afea745c6672c67d6bbbe1d377_wrap.o -O0
a096a21db40e01afea745c6672c67d6bbbe1d377_wrap.cxx: In function ‘PyObject* _wrap_ffc_form_a096a21db40e01afea745c6672c67d6bbbe1d377_cell_integral_0_0_tabulate_tensor__SWIG_1(PyObject*, int, PyObject**)’:
a096a21db40e01afea745c6672c67d6bbbe1d377_wrap.cxx:3548: error: ‘SWIG_exception’ was not declared in this scope
error: command 'gcc' failed with exit status 1

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Paul Constantine
Solved:
Last query:
Last reply:
Revision history for this message
Johan Hake (johan-hake) said :
#1

Probably not related, but it looks like you pick up a system wide
installation of instant. Maybe

  sudo apt-get purge instant

If that does not help. Could you paste (use pastebin or something
similar) or maybe send me privately the content of:

/home/paulcon/.instant/error/a096a21db40e01afea745c6672c67d6bbbe1d377/a096a21db40e01afea745c6672c67d6bbbe1d377_wrap.cxx

and

/home/paulcon/.instant/error/a096a21db40e01afea745c6672c67d6bbbe1d377/a096a21db40e01afea745c6672c67d6bbbe1d377.i

Johan

On 01/15/2013 10:21 PM, Paul Constantine wrote:
> New question #219273 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/219273
>
> I'm getting the following error running the navier-stokes demo.
>
> I have dolfin 1.1, ffc 1.1, fiat 1.1, instant 1.1, ufc 2.1.
>
> $ python demo_navier-stokes.py
> Calling FFC just-in-time (JIT) compiler, this may take some time.
> In instant.recompile: The module did not compile, see '/home/paulcon/.instant/error/a096a21db40e01afea745c6672c67d6bbbe1d377/compile.log'
> Traceback (most recent call last):
> File "demo_navier-stokes.py", line 37, in <module>
> V = VectorFunctionSpace(mesh, "CG", 2)
> File "/usr/local/lib64/python2.6/site-packages/dolfin/functions/functionspace.py", line 533, in __init__
> FunctionSpaceBase.__init__(self, mesh, element)
> File "/usr/local/lib64/python2.6/site-packages/dolfin/functions/functionspace.py", line 78, in __init__
> ufc_element, ufc_dofmap = jit(self._ufl_element)
> File "/usr/local/lib64/python2.6/site-packages/dolfin/compilemodules/jit.py", line 66, in mpi_jit
> return local_jit(*args, **kwargs)
> File "/usr/local/lib64/python2.6/site-packages/dolfin/compilemodules/jit.py", line 154, in jit
> return jit_compile(form, parameters=p, common_cell=common_cell)
> File "/usr/lib/python2.6/site-packages/ffc/jitcompiler.py", line 71, in jit
> return jit_element(ufl_object, parameters)
> File "/usr/lib/python2.6/site-packages/ffc/jitcompiler.py", line 177, in jit_element
> compiled_form, module, form_data, prefix = jit_form(form, parameters)
> File "/usr/lib/python2.6/site-packages/ffc/jitcompiler.py", line 145, in jit_form
> cache_dir = cache_dir)
> File "/usr/local/lib64/python2.6/site-packages/ufc_utils/build.py", line 73, in build_ufc_module
> **kwargs)
> File "/usr/lib/python2.6/site-packages/instant/build.py", line 482, in build_module
> recompile(modulename, module_path, setup_name, new_compilation_checksum)
> File "/usr/lib/python2.6/site-packages/instant/build.py", line 105, in recompile
> "compile, see '%s'" % compile_log_filename_dest)
> File "/usr/lib/python2.6/site-packages/instant/output.py", line 49, in instant_error
> raise RuntimeError(text)
> RuntimeError: In instant.recompile: The module did not compile, see '/home/paulcon/.instant/error/a096a21db40e01afea745c6672c67d6bbbe1d377/compile.log'
>
> ----
>
> $ cat compile.log
> running build_ext
> building '_a096a21db40e01afea745c6672c67d6bbbe1d377' extension
> creating build
> creating build/temp.linux-x86_64-2.6
> gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/local/include -I/usr/local/include -I/usr/include/python2.6 -c a096a21db40e01afea745c6672c67d6bbbe1d377_wrap.cxx -o build/temp.linux-x86_64-2.6/a096a21db40e01afea745c6672c67d6bbbe1d377_wrap.o -O0
> a096a21db40e01afea745c6672c67d6bbbe1d377_wrap.cxx: In function ‘PyObject* _wrap_ffc_form_a096a21db40e01afea745c6672c67d6bbbe1d377_cell_integral_0_0_tabulate_tensor__SWIG_1(PyObject*, int, PyObject**)’:
> a096a21db40e01afea745c6672c67d6bbbe1d377_wrap.cxx:3548: error: ‘SWIG_exception’ was not declared in this scope
> error: command 'gcc' failed with exit status 1
>
>

Revision history for this message
Paul Constantine (paul-g-constantine) said :
#2
Revision history for this message
Paul Constantine (paul-g-constantine) said :
#3

FYI. I'm on CentOS 5.

Revision history for this message
Johan Hake (johan-hake) said :
#4

Strange. Can you:

  instant-clean
  rm -rf /home/paulcon/.instant/error

I get a feeling that the files in error are old.

Johan

On 01/15/2013 11:21 PM, Paul Constantine wrote:
> Question #219273 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/219273
>
> Paul Constantine gave more information on the question:
> FYI. I'm on CentOS 5.
>

Revision history for this message
Paul Constantine (paul-g-constantine) said :
#5

Thanks. I did that. Now I get this:

$ python demo_navier-stokes.py
Traceback (most recent call last):
  File "demo_navier-stokes.py", line 28, in <module>
    from dolfin import *
  File "/usr/local/lib64/python2.6/site-packages/dolfin/__init__.py", line 39, in <module>
    from dolfin.functions import *
  File "/usr/local/lib64/python2.6/site-packages/dolfin/functions/__init__.py", line 3, in <module>
    from dolfin.functions import functionspace
  File "/usr/local/lib64/python2.6/site-packages/dolfin/functions/functionspace.py", line 43, in <module>
    from dolfin.compilemodules.jit import jit
  File "/usr/local/lib64/python2.6/site-packages/dolfin/compilemodules/__init__.py", line 2, in <module>
    from dolfin.compilemodules import compilemodule
  File "/usr/local/lib64/python2.6/site-packages/dolfin/compilemodules/compilemodule.py", line 33, in <module>
    from dolfin_utils.cppparser import *
ImportError: No module named dolfin_utils.cppparser

Revision history for this message
Johan Hake (johan-hake) said :
#6

What does:

  python -c"import dolfin_utils"

and

  ls -d /usr/local/lib64/python2.6/site-packages/dolfin*

give you?

dolfin_utils should be installed at the same place as your dolfin
installation if you installed from source.

Johan

On 01/15/2013 11:35 PM, Paul Constantine wrote:
> Question #219273 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/219273
>
> Status: Answered => Open
>
> Paul Constantine is still having a problem:
> Thanks. I did that. Now I get this:
>
> $ python demo_navier-stokes.py
> Traceback (most recent call last):
> File "demo_navier-stokes.py", line 28, in <module>
> from dolfin import *
> File "/usr/local/lib64/python2.6/site-packages/dolfin/__init__.py", line 39, in <module>
> from dolfin.functions import *
> File "/usr/local/lib64/python2.6/site-packages/dolfin/functions/__init__.py", line 3, in <module>
> from dolfin.functions import functionspace
> File "/usr/local/lib64/python2.6/site-packages/dolfin/functions/functionspace.py", line 43, in <module>
> from dolfin.compilemodules.jit import jit
> File "/usr/local/lib64/python2.6/site-packages/dolfin/compilemodules/__init__.py", line 2, in <module>
> from dolfin.compilemodules import compilemodule
> File "/usr/local/lib64/python2.6/site-packages/dolfin/compilemodules/compilemodule.py", line 33, in <module>
> from dolfin_utils.cppparser import *
> ImportError: No module named dolfin_utils.cppparser
>

Revision history for this message
Paul Constantine (paul-g-constantine) said :
#7

Good catch! For some reason, I had the python packages split between /usr/local/lib and /usr/local/lib64.

Is there a way I can explicitly set the python site-package directory in setup.py and/or with cmake for ufc and dolfin?

Revision history for this message
Garth Wells (garth-wells) said :
#8

On 16 January 2013 18:11, Paul Constantine
<email address hidden> wrote:
> Question #219273 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/219273
>
> Status: Answered => Open
>
> Paul Constantine is still having a problem:
> Good catch! For some reason, I had the python packages split between
> /usr/local/lib and /usr/local/lib64.
>
> Is there a way I can explicitly set the python site-package directory in
> setup.py and/or with cmake for ufc and dolfin?
>

   python setup.py install --prefix=/foo/bar

and then

    export PYTHONPATH=/foo/bar/lib/python2.X/site-packages:$PYTHONPATH

Garth

> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.

Revision history for this message
Paul Constantine (paul-g-constantine) said :
#9

Part of the problem seems to be with ufc 2.1. Per the above discussion, I'd like to put everything in /usr/local/lib. But when I do 'sudo make install', I get this:

$ sudo make install
Scanning dependencies of target _ufc
[100%] Built target _ufc
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /usr/local/include/ufc.h
-- Up-to-date: /usr/local/include/swig/ufc.i
-- Up-to-date: /usr/local/lib64/python2.6/site-packages/ufc/_ufc.so
-- Up-to-date: /usr/local/lib64/python2.6/site-packages/ufc/ufc.py
-- Up-to-date: /usr/local/lib64/python2.6/site-packages/ufc/__init__.py
-- Installing: /usr/local/lib/python2.6/site-packages/ufc_utils
-- Up-to-date: /usr/local/lib/python2.6/site-packages/ufc_utils/finite_element.py
-- Up-to-date: /usr/local/lib/python2.6/site-packages/ufc_utils/__init__.py
-- Up-to-date: /usr/local/lib/python2.6/site-packages/ufc_utils/form.py
-- Up-to-date: /usr/local/lib/python2.6/site-packages/ufc_utils/dofmap.py
-- Up-to-date: /usr/local/lib/python2.6/site-packages/ufc_utils/function.py
-- Up-to-date: /usr/local/lib/python2.6/site-packages/ufc_utils/build.py
-- Up-to-date: /usr/local/lib/python2.6/site-packages/ufc_utils/integrals.py
-- Up-to-date: /usr/local/share/ufc/UFCConfig.cmake
-- Up-to-date: /usr/local/share/ufc/UFCConfigVersion.cmake
-- Up-to-date: /usr/local/lib/pkgconfig/ufc-1.pc

Is this correct? Is there a way to change in the cmake? Or should I leave it as is?

Revision history for this message
Paul Constantine (paul-g-constantine) said :
#10

Here's what was in my CMakeCache.txt:

//Python extension module installation directory.
UFC_INSTALL_PYTHON_EXT_DIR:PATH=lib64/python2.6/site-packages

//Python module installation directory.
UFC_INSTALL_PYTHON_MODULE_DIR:PATH=lib/python2.6/site-packages

Not sure how it got set that way. But removing it and starting over results in the same thing.

Revision history for this message
Garth Wells (garth-wells) said :
#11

On 18 January 2013 17:56, Paul Constantine
<email address hidden> wrote:
> Question #219273 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/219273
>
> Paul Constantine gave more information on the question:
> Here's what was in my CMakeCache.txt:
>
> //Python extension module installation directory.
> UFC_INSTALL_PYTHON_EXT_DIR:PATH=lib64/python2.6/site-packages
>
> //Python module installation directory.
> UFC_INSTALL_PYTHON_MODULE_DIR:PATH=lib/python2.6/site-packages
>
> Not sure how it got set that way. But removing it and starting over
> results in the same thing.
>

CMake will query Python to find our where things should go on your
distribution. To override this, you should be able to add the option

    -D UFC_INSTALL_PYTHON_EXT_DIR:PATH=/foo/bar

when calling CMake.

Even easier is to use cmake-gui. You'll get a nice gui for inspecting
and changing options.

Garth

> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.

Revision history for this message
Paul Constantine (paul-g-constantine) said :
#12

hallelujah. it works. thanks again for everyone's help.