Unable to Plot Dolfin Demos after Upgrade

Asked by Ted Kord on 2009-12-26

Hello

I upgraded all FEniCS packages and now I'm unable to plot any of the demos. For instance, in the C ++Poisson1D example, this is the result after running ./demo:

Solving linear variational problem
  Matrix of size 51 x 51 has 151 nonzero entries.
  Sorting sparsity pattern.
  Applying boundary conditions to linear system.
  LU-factorizing linear system of size 51 x 51 (UMFPACK).
  Solving factorized linear system of size 51 x 51 (UMFPACK).
Plotting x (unnamed data), press 'q' to continue...
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/viper", line 225, in <module>
    _newmain()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/viper", line 220, in _newmain
    p = __main(infile, lutfile, mode, title)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/viper", line 152, in __main
    return _plot_mesh(infile, lutfile, mode, title)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/viper", line 116, in _plot_mesh
    import dolfin
  File "/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/__init__.py", line 32, in <module>
    from constant import *
  File "/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/constant.py", line 14, in <module>
    class Constant(ufl.Function, cpp.Constant):
AttributeError: 'module' object has no attribute 'Function'
*** Warning: Unable to plot.

Any thoughts?

Thanks.

Ted

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Myles English
Solved:
2009-12-31
Last query:
2009-12-31
Last reply:
2009-12-31
Ted Kord (teddy-kord) said : #1

I removed all packages, installed the unstable releases and all cpp demos work fine now.

The python demos still fail though with:

Calling FFC just-in-time (JIT) compiler, this may take some time.
Traceback (most recent call last):
  File "demo.py", line 24, in <module>
    V = FunctionSpace(mesh, "CG", 1)
  File "/Users/tedkord/FEniCS/build/lib/python2.6/site-packages/dolfin/function/functionspace.py", line 226, in __init__
    FunctionSpaceBase.__init__(self, mesh, element)
  File "/Users/tedkord/FEniCS/build/lib/python2.6/site-packages/dolfin/function/functionspace.py", line 44, in __init__
    ufc_element, ufc_dofmap = jit(self._ufl_element)
  File "/Users/tedkord/FEniCS/build/lib/python2.6/site-packages/dolfin/compilemodules/jit.py", line 44, in mpi_jit
    return local_jit(*args, **kwargs)
  File "/Users/tedkord/FEniCS/build/lib/python2.6/site-packages/dolfin/compilemodules/jit.py", line 108, in jit
    return jit_compile(form, options)
  File "/Users/tedkord/FEniCS/build/lib/python2.6/site-packages/ffc/jit.py", line 64, in jit
    return jit_element(object, options)
  File "/Users/tedkord/FEniCS/build/lib/python2.6/site-packages/ffc/jit.py", line 151, in jit_element
    (compiled_form, module, form_data) = jit_form(form, options)
  File "/Users/tedkord/FEniCS/build/lib/python2.6/site-packages/ffc/jit.py", line 112, in jit_form
    preprocessed_form, form_data = compile_form(preprocessed_form, signature, options)[0]
  File "/Users/tedkord/FEniCS/build/lib/python2.6/site-packages/ffc/compiler.py", line 87, in compile_form
    form, form_data = analyze_form(form, object_names, options)
  File "/Users/tedkord/FEniCS/build/lib/python2.6/site-packages/ffc/compiler.py", line 145, in analyze_form
    form_data = FormData(form, object_names=object_names)
  File "/Users/tedkord/FEniCS/build/lib/python2.6/site-packages/ufl/algorithms/formdata.py", line 51, in __init__
    for i in range(self.rank)]
AttributeError: 'str' object has no attribute 'get'

Any help is appreciated.

Regards

Ted

Ted Kord (teddy-kord) said : #2

Hello

Could someone please help me with this problem. I'm unable to run any Python demo. I always get the above; ending with;

AttributeError: 'str' object has no attribute 'get'

HELP!

Ted

Myles English (mylesenglish) said : #3

I get this too, but I don't know why.

Myles

Myles English (mylesenglish) said : #4
Best Myles English (mylesenglish) said : #5

Ted,

This little change makes (at least) "python demo/pde/poisson1D/python/demo.py" work.

=== modified file 'ffc/jit.py'
--- ffc/jit.py 2009-12-15 15:43:45 +0000
+++ ffc/jit.py 2009-12-31 17:57:24 +0000
@@ -109,7 +109,7 @@

     # Generate code
     signature = jit_object.signature()
- preprocessed_form, form_data = compile_form(preprocessed_form, signature, options)[0]
+ preprocessed_form, form_data = compile_form(preprocessed_form, {}, signature, options)[0]

     # Create python extension module using Instant (through UFC)
     debug("Creating Python extension (compiling and linking), this may take some time...")

Myles

Garth Wells (garth-wells) said : #6

Myles English wrote:
> Question #95274 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/95274
>
> Myles English proposed the following answer:
> Ted,
>
> This little change makes (at least) "python
> demo/pde/poisson1D/python/demo.py" work.
>
> === modified file 'ffc/jit.py'
> --- ffc/jit.py 2009-12-15 15:43:45 +0000
> +++ ffc/jit.py 2009-12-31 17:57:24 +0000
> @@ -109,7 +109,7 @@
>
> # Generate code
> signature = jit_object.signature()
> - preprocessed_form, form_data = compile_form(preprocessed_form, signature, options)[0]
> + preprocessed_form, form_data = compile_form(preprocessed_form, {}, signature, options)[0]
>
> # Create python extension module using Instant (through UFC)
> debug("Creating Python extension (compiling and linking), this may take some time...")
>

I've just pushed this fix to the development repository. Thanks for
pointing it out.

Garth

>
> Myles
>
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~dolfin
> More help : https://help.launchpad.net/ListHelp

Ted Kord (teddy-kord) said : #7

Fantastic. Thx Myles, that solved the problem. All the demos work fine.

Ted

Ted Kord (teddy-kord) said : #8

Thanks Myles English, that solved my question.