All python demos result in error -- TypeError: in method 'new_FiniteElement' argument 1 of type 'boost::shared_ptr< ufc::finite_element const >'

Asked by Robert Crim

I'm on Snow Leopard, and build FEniCS with dorsal-0.8.2. Dependencies installed with macports, on a fresh OS X install.

Everything I run results in the error below. Other people who have had this problem seemed to resolved it by running instant-clean, which appears to run successfully, but I still get the same error.

rob@cosmo python $ python demo.py
Calling FFC just-in-time (JIT) compiler, this may take some time.
Traceback (most recent call last):
  File "demo.py", line 22, in <module>
    V = VectorFunctionSpace(mesh, "CG", 2)
  File "/Users/rob/Development/FEniCS/lib/python2.7/site-packages/dolfin/function/functionspace.py", line 321, in __init__
    restriction=restriction)]
  File "/Users/rob/Development/FEniCS/lib/python2.7/site-packages/dolfin/function/functionspace.py", line 237, in __init__
    FunctionSpaceBase.__init__(self, mesh, element)
  File "/Users/rob/Development/FEniCS/lib/python2.7/site-packages/dolfin/function/functionspace.py", line 47, in __init__
    self._dolfin_element = cpp.FiniteElement(ufc_element)
  File "/Users/rob/Development/FEniCS/lib/python2.7/site-packages/dolfin/cpp.py", line 14561, in __init__
    _cpp.FiniteElement_swiginit(self,_cpp.new_FiniteElement(*args))
TypeError: in method 'new_FiniteElement', argument 1 of type 'boost::shared_ptr< ufc::finite_element const >'

Any advice is much appreciated!

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Harish Narayanan
Solved:
Last query:
Last reply:
Revision history for this message
Robert Crim (rjcrim) said :
#1

I have swig 2.0.4 installed. Should I be using a different version for stable FEniCS build?

Revision history for this message
Harish Narayanan (hnarayanan) said :
#2

I am running into the same problem. I too am on Snow Leopard and this problem shows up both for the last stable FEniCS release and for the current development version.

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

Strange...

Have you tried downgrade the SWIG version? Are old FEniCS installation hanging around? PYTHONPATH is set correctly?

Johan

Revision history for this message
Best Harish Narayanan (hnarayanan) said :
#4

I just built Swig (2.0.3) via Dorsal, rebuilt FEniCS and everything is fine. So I am guessing this has something to do with Swig 2.0.4.

Robert: Edit the file dorsal/FEniCS/platforms/contributed/fenics.platform and add the word 'swig' to the top of the package list.

...
PACKAGES=(
swig
skip:parmetis
# trilinos
skip:petsccore
...

Now, run Dorsal via:

./dorsal.sh FEniCS/platforms/contributed/fenics.platform

This should build Swig 2.0.3 and rebuild FEniCS for you, temporarily working around this problem.

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

On 19/06/11 17:01, Harish Narayanan wrote:
> Question #161902 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/161902
>
> Harish Narayanan proposed the following answer:
> I just built Swig (2.0.3) via Dorsal, rebuilt FEniCS and everything is
> fine. So I am guessing this has something to do with Swig 2.0.4.
>

Swig 2.0.4 works fine for me under Ubuntu Natty.

Garth

> Robert: Edit the file
> dorsal/FEniCS/platforms/contributed/fenics.platform and add the word
> 'swig' to the top of the package list.
>
> ...
> PACKAGES=(
> swig
> skip:parmetis
> # trilinos
> skip:petsccore
> ...
>
> Now, run Dorsal via:
>
> ./dorsal.sh FEniCS/platforms/contributed/fenics.platform
>
> This should build Swig 2.0.3 and rebuild FEniCS for you, temporarily
> working around this problem.
>

Revision history for this message
Robert Crim (rjcrim) said :
#6

Thanks Harish Narayanan, that solved my question.