Subject: [Ufl] [Question #161420]: problem with python 2.7.1

From: Andreas Naumann <[email-masked]>
Date: Tue, 14 Jun 2011 16:50:56 -0000

New question #161420 on UFL:
https://answers.launchpad.net/ufl/+question/161420

Hi @all

i try to install fenics with ufl 0.9.0 on our hpc cluster using python 2.7.1.

As a small test, i used the poisson example
element = FiniteElement("Lagrange", triangle, 1)

u = TrialFunction(element)
v = TestFunction(element)
f = Coefficient(element)
g = Coefficient(element)

a = inner(grad(u), grad(v))*dx
L = f*v*dx + g*v*ds

This small example leads to the following problem with
ufl-analyse -w 1 Poisson.ufl

Loading form file 'Poisson.ufl'
Invalid object type <class 'ufl.algorithms.formdata.FormData'>
Traceback (most recent call last):
  File "/home/anaum/deimos/local/bin/ufl-analyse", line 96, in <module>
    write("\n\nForm tree formatting (preprocessed):\n", tree_format(preprocessed_form))
  File "/home/anaum/deimos/local/lib/python2.7/site-packages/ufl/algorithms/printing.py", line 130, in tree_format
    error("Invalid object type %s" % type(expression))
  File "/home/anaum/deimos/local/lib/python2.7/site-packages/ufl/log.py", line 135, in error
    raise self._exception_type(self._format_raw(*message))
ufl.log.UFLException: Invalid object type <class 'ufl.algorithms.formdata.FormData'>

The created logfile Poisson.ufl.log has the content

Form data:
 None

Form pretty-print (original):
 { (grad(v_{-1})) : (grad(v_{-2})) } * dx0

Form pretty-print (preprocessed):
 Name:                             'a'
Rank:                             2
Cell:                             <triangle cell in R2>
Topological dimension:            2
Geometric dimension:              2
Number of facets:                 3
Number of coefficients:           0
Number of cell domains:           1
Number of exterior facet domains: 0
Number or interior facet domains: 0
Number of macro cell domains:     0
Number of surface domains:        0
Arguments:                        '[v_0, v_1]'
Coefficients:                     '[]'
Argument names:                   '[v, u]'
Coefficient names:                '[]'
Unique elements:                  'CG1(?)'
Unique sub elements:              'CG1(?)'

Form representation (original):
 Form([Integral(Inner(Grad(Argument(FiniteElement('Lagrange', Cell('triangle', Space(2)), 1, None), -1)), Grad(Argument(FiniteElement('Lagrange', Cell('triangle', Space(2)), 1, None), -2))), Measure('cell', 0, None))])

Form representation (preprocessed):
 <ufl.algorithms.formdata.FormData object at 0x2b98a0542650>

Form tree formatting (original):
 Form:
    Integral:
        domain type: cell
        domain id: 0
        integrand:
            Inner
            (
                Grad
                    Argument(FiniteElement('Lagrange', Cell('triangle', Space(2)), 1, None), -1)
                Grad
                    Argument(FiniteElement('Lagrange', Cell('triangle', Space(2)), 1, None), -2)
            )

If I use the same with the fenics form compiler (version 0.9.9), I get the error:

Traceback (most recent call last):
  File "/home/anaum/deimos/local/bin/ffc", line 176, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/home/anaum/deimos/local/bin/ffc", line 157, in main
    compile_form(ufd.forms, ufd.object_names, prefix, parameters)
  File "/home/anaum/deimos/local/lib/python2.7/site-packages/ffc/compiler.py", line 135, in compile_form
    analysis = analyze_forms(forms, object_names, parameters)
  File "/home/anaum/deimos/local/lib/python2.7/site-packages/ffc/analysis.py", line 49, in analyze_forms
    forms = tuple(_analyze_form(form, object_names, parameters, common_cell) for form in forms)
  File "/home/anaum/deimos/local/lib/python2.7/site-packages/ffc/analysis.py", line 49, in <genexpr>
    forms = tuple(_analyze_form(form, object_names, parameters, common_cell) for form in forms)
  File "/home/anaum/deimos/local/lib/python2.7/site-packages/ffc/analysis.py", line 117, in _analyze_form
    info(str(form.form_data()))
AttributeError: 'FormData' object has no attribute 'form_data'

Currently, I don't know if the problem comes from the ffc or from ufl. 
Do you have any hint, or idea to solve the problem? 
If you need more information, I will see if I can provide them.

Regards
Andreas

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

---

From: Martin Sandve Alnæs<[email-masked]>
Date: Mon, 27 Jun 2011 13:31:06 -0000

Question #161420 on UFL changed:
https://answers.launchpad.net/ufl/+question/161420

    Status: Open => Answered

Martin Sandve Alnæs proposed the following answer:
Strange. Still having this problem? Did you download tarballs or get
development snapshots? Why did youn't you choose the latest releases?

---

From: Andreas Naumann <[email-masked]>
Date: Mon, 27 Jun 2011 14:21:16 -0000

Andreas Naumann posted a new comment:
I tried the following things:
   * dorsal: does not allow selecting a version at all. I thought, it should work as on my "home" debian system.
   * using the latest tarball 0.9.1 for ufl and the latest tarball from ffc... both had the same problem.

I digged in the code. The class "FormData" really doesn't have an
attribute form_data, but the class "Form" does have.

I am really puzzled, because dorsal downloads the same version, only the python interpreter changes. 
This could matter, if it would be an older interpreter, but 2.7 should be newer than 2.6, which ffc uses on my system :)

I have no idea, where to look and possibly reduce the problem to a
smaller one.

---

From: Martin Sandve Alnæs<[email-masked]>
Date: Mon, 27 Jun 2011 14:36:21 -0000

Martin Sandve Alnæs proposed the following answer:
Could it be a path mixup? If you have an old installation of ufl/ffc,
try deleting them (or moving them out of the path).