errors running the first example (d1_p2D.py) in tutorial

Asked by Panu Sam-ang on 2013-02-17

After running the first python example "d1_p2D.py" in the directory : examples-1.0/stationary/poisson. I got this warning and error message:
"
*** Warning: UnitSquare has been deprecated in DOLFIN version 1.1.0.
*** The class UnitSquare has been replaced by UnitSquareMesh.
...."

So then I changed "UnitSquare" to "UnitSquareMesh" in the code and it gave me this error message:
"
  File "d1_p2D.py", line 15, in <module>
    V = FunctionSpace(mesh, 'Lagrange', 1)
  File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/dolfin/functions/functionspace.py", line 381, in __init__
    FunctionSpaceBase.__init__(self, mesh, element)
  File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/dolfin/functions/functionspace.py", line 78, in __init__
    ufc_element, ufc_dofmap = jit(self._ufl_element)
  File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/dolfin/compilemodules/jit.py", line 66, in mpi_jit
    return local_jit(*args, **kwargs)
  File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/dolfin/compilemodules/jit.py", line 102, in jit
    raise OSError, "Could not find swig installation. Pass an existing "\
OSError: Could not find swig installation. Pass an existing swig binary or install SWIG version 2.0 or higher. "

Can someone help me with this?

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Johannes Ring
Solved:
2013-02-27
Last query:
2013-02-27
Last reply:
2013-02-27
Johannes Ring (johannr) said : #1

What do you get when you type in these two commands:

  which swig
  swig -version

Are you using the 1.1.0 dmg bundle or a nightly snapshot?

Panu Sam-ang (panu1201) said : #2

Thank you very much for helping.
I use Mac OS X 10.8.2

This is what I got after I typed which swig:
"/Applications/FEniCS.app/Contents/Resources/bin/swig"

And this is what I got after typing swig -version:
"SWIG Version 2.0.8

Compiled with /usr/bin/g++ [i386-apple-darwin11.4.2]

Configured options: +pcre

Please see http://www.swig.org for reporting bugs and further information"

I am using 1.1.0 dmg bundle here http://fenicsproject.org/download/osx_details.html#osx-details (fenics-1.1.0-osx10.7.dmg)

Panu Sam-ang (panu1201) said : #3

Can someone help me with this? I really want this to get working.

Panu Sam-ang (panu1201) said : #4

I removed this file " “dolfin_parameters.xml” in the directory /stationary/poisson. Now I don't get that long error message anymore (it shows only the warning "Warning: UnitSquare has been deprecated in DOLFIN version 1.1.0.") and I see the plots.

Can someone explain why removing the file "dolfin_parameters.xml" helps and without this file, would it cause problem ?

Johannes Ring (johannr) said : #6

Perhaps 'swig_binary' was set in 'dolfin_parameters.xml'?

Panu Sam-ang (panu1201) said : #7

This is what I have in 'dolfin_parameters.xml' by default (I did not change anything) about swig:
"
    <parameter key="swig_binary" type="string" value="swig2.0" />
    <parameter key="swig_path" type="string" value="" /> ".

Should I change something here?

Johannes Ring (johannr) said : #8

The problem is that "swig_binary" is set to "swig2.0". Where did you get that file?

Panu Sam-ang (panu1201) said : #9

I got it from " a tarball with all programs referred to in this tutorial " on http://fenicsproject.org/documentation/tutorial/index.html .

Best Johannes Ring (johannr) said : #10

The dolfin_parameters.xml file appears to not work well on all platforms. However, it is only there as an example, so you can just remove it or rename it to "dolfin_parameters.xml.sample" or whatever you like.

Panu Sam-ang (panu1201) said : #11

Thanks Johannes Ring, that solved my question.