Subject: [Deb-dev] Runtime Error when running the FEniCS tutorial demo after installation on kubuntu-hardy system

From: Timm Höhr <[email-masked]>
Date: Sun, 11 Jan 2009 23:59:55 +0100

Hi,

I am a complete newbie with fenics. I just installed it and wanted to 
try it out.

But I get a Runtime error when I try to run the demo from the fenics 
tutorial page (http://www.fenics.org/wiki/Tutorial).

This is what I did:

Meanwhile, the tutorial on the FEniCS web site changed and I tried out 
the new example:

I installed fenics on my computer (kubuntu 8.04.1 hardy). This is what I 
dit for installation:
# sudo wget http://packages.simula.no/hardy.list -O 
/etc/apt/sources.list.d/simula.list
# wget http://packages.simula.no/pubring.gpg -O- | sudo apt-key add -
(then I installed fenics using the adept-manager.)
#cp -r /usr/share/doc/dolfin-doc $HOME/

So, I copied the demo (see end of email) into an editor and saved it as 
demo.py and tried to run it. I got several warnings and errors.

Then, I did an actualisation of the packages python, numpy-ext and 
libxml2 via adept-manager.
I also did the recommended change in the file 
/etc/openmpi/openmpi-mca-params.conf as recommended in the FAQ and got 
rid of some warnings as described.
(http://www.fenics.org/wiki/Frequently_asked_questions)

But still, I get the following output:
# python demo.py
Solving linear PDE.
Calling FFC just-in-time (JIT) compiler, this may take some time... done
Creating Python extension (compiling and linking), this may take some 
time...In instant.recompile: The module did not compile, see 
'/tmp/tmpsmqYYZ2009-1-4-23-58_instant/form_7108899196e137cb2c1233de8801b9ee2be3d015/compile.log'

Traceback (most recent call last):
   File "demo.py", line 47, in <module>
     u = pde.solve()
   File "/usr/lib/python2.5/site-packages/dolfin/pde.py", line 55, in solve
     (compiled_form, module, form_data) = jit(self.a)
   File "/usr/lib/python2.5/site-packages/dolfin/assemble.py", line 198, 
in jit
     return jit_compile(form, options)
   File "/usr/lib/python2.5/site-packages/ffc/jit/jit.py", line 54, in jit
     return jit_form(object, options)
   File "/usr/lib/python2.5/site-packages/ffc/jit/jit.py", line 88, in 
jit_form
     cache_dir=options["cache_dir"])
   File "/usr/lib/python2.5/site-packages/instant/build.py", line 423, 
in build_module
     recompile(modulename, module_path, setup_name, 
new_compilation_checksum)
   File "/usr/lib/python2.5/site-packages/instant/build.py", line 101, 
in recompile
     "compile, see '%s'" % compile_log_filename)
   File "/usr/lib/python2.5/site-packages/instant/output.py", line 49, 
in instant_error
     raise RuntimeError(text)
RuntimeError: In instant.recompile: The module did not compile, see 
'/tmp/tmpsmqYYZ2009-1-4-23-58_instant/form_7108899196e137cb2c1233de8801b9ee2be3d015/compile.log'

The content of 'compile.log' is:
building '_form_7108899196e137cb2c1233de8801b9ee2be3d015' extension
creating build
creating build/temp.linux-i686-2.5
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall 
-Wstrict-prototypes -fPIC -I/usr/include -I/usr/include/python2.5 -c 
form_7108899196e137cb2c1233de8801b9ee2be3d015_wrap.cxx -o 
build/temp.linux-i686-2.5/form_7108899196e137cb2c1233de8801b9ee2be3d015_wrap.o 
-O0
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'gcc' failed with exit status 1

Here I got stuck.

I would appreciate any help.

Thanks,
Timm

---------------------------------------------------------------------------------
tutorial script:

from dolfin import *

# Create mesh and finite element
mesh = UnitSquare(32, 32)
element = FiniteElement("Lagrange", "triangle", 1)

# Source term
class Source(Function):
     def __init__(self, element, mesh):
         Function.__init__(self, element, mesh)
     def eval(self, values, x):
         dx = x[0] - 0.5
         dy = x[1] - 0.5
         values[0] = 500.0*exp(-(dx*dx + dy*dy)/0.02)

# Neumann boundary condition
class Flux(Function):
     def __init__(self, element, mesh):
         Function.__init__(self, element, mesh)
     def eval(self, values, x):
         if x[0] > DOLFIN_EPS:
             values[0] = 25.0*sin(5.0*DOLFIN_PI*x[1])
         else:
             values[0] = 0.0

# Sub domain for Dirichlet boundary condition
class DirichletBoundary(SubDomain):
     def inside(self, x, on_boundary):
         return bool(on_boundary and x[0] < DOLFIN_EPS)

# Define variational problem
v = TestFunction(element)
u = TrialFunction(element)
f = Source(element, mesh)
g = Flux(element, mesh)

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

# Define boundary condition
u0 = Function(mesh, 0.0)
boundary = DirichletBoundary()
bc = DirichletBC(u0, mesh, boundary)

# Solve PDE and plot solution
pde = LinearPDE(a, L, mesh, bc)
u = pde.solve()
plot(u)

# Save solution to file
file = File("poisson.pvd")
file << u

---

From: "Johannes Ring" <[email-masked]>
Date: Mon, 12 Jan 2009 09:04:01 +0100 (CET)

Hi Timm,

> tutorial page (http://www.fenics.org/wiki/Tutorial).

The demo on that page requires DOLFIN 0.9.0 which is, unfortunately, not
packaged for Debian/Ubuntu yet. We are waiting for a new release of Viper
before we will upload new packages. Hopefully this will be out one of the
first days this week.

> I would appreciate any help.

It seems as if you don't have a C++ compiler installed. Try to install the
build-essential package and see if that helps. This package should
probably be a dependency for the python-instant package.

Johannes

---

From: "Johannes Ring" <[email-masked]>
Date: Tue, 13 Jan 2009 09:05:57 +0100 (CET)

On Mon, January 12, 2009 23:06, Timm Höhr wrote:
> Hi Johannes,
>
> thanks a lot! Although gcc was already installed, the build-essential
> package made the difference.

Good. I will add build-essential as a dependency to the Instant package.

> Now I try to get the vtu-file visualized. ParaView does not offer easy
> hints how to install it.

ParaView is in the latest Ubuntu release (Intrepid) and you should be able
to install it on Hardy by enabling the Intrepid sources temporarily. Let
me know if you want some instructions on how to do this.

> But, I found mayavi2 is available via aptdept
> and installed it. It runs but it seems I first have to read some docs,
> before getting a view on the result of the calculation.
>
> Which visualization software are you using?

Nothing in particular at the moment.

> Timm
>
> P.S.: Should I reply also to the list?

Yes, I'm cc'ing the list.

Johannes

> Johannes Ring wrote:

---

From: Timm Höhr <[email-masked]>
Date: Wed, 14 Jan 2009 00:22:13 +0100

> me know if you want some instructions on how to do this.

Yes, I would appreciate some instructions. Is the mixing of different 
versions not dangerous (package dependencies etc.)? How do I avoid 
conflicts?
I simply used the adept manager so far. For installing FEniCS I added 
the source "http://packages.simula.no/ hardy main" in the "third-party 
software" section.
Is this also the place to include the intrepid sources?

---

From: "Garth N. Wells" <[email-masked]>
Date: Tue, 13 Jan 2009 23:24:56 +0000

Timm Höhr wrote:
> Yes, I would appreciate some instructions. 

If you can't get it through your package manager, the the easiest it to 
just download ParaView from www.paraview.org. It's distributed as a 
binary executable.

Garth

Is the mixing of different
> _______________________________________________
> Deb-dev mailing list
> [email-masked]
> http://fenics.org/mailman/listinfo/deb-dev

---

From: "Johannes Ring" <[email-masked]>
Date: Wed, 14 Jan 2009 09:32:28 +0100 (CET)

> just download ParaView from www.paraview.org. It's distributed as a

This is perhaps a better solution, but here is how I did it using the
package manager:

1. Open the file /etc/apt/sources.list with your favorite editor:

sudo emacs /etc/apt/sources.list

2. Add these four lines at the bottom:

deb http://archive.ubuntu.com/ubuntu/ intrepid main restricted universe
multiverse
deb-src http://archive.ubuntu.com/ubuntu/ intrepid main restricted
universe multiverse
deb http://archive.ubuntu.com/ubuntu/ intrepid-updates main restricted
universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ intrepid-updates main restricted
universe multiverse

3. Save and close the file and update the APT sources:

sudo apt-get update

4. Install ParaView:

sudo apt-get install paraview

5. Open up /etc/apt/sources.list again and comment out (or remove) the
four lines added in step 2 above. You do this by adding a '#' in front of
each line, like this:

#deb http://archive.ubuntu.com/ubuntu/ intrepid main restricted universe
multiverse
#deb-src http://archive.ubuntu.com/ubuntu/ intrepid main restricted
universe multiverse
#deb http://archive.ubuntu.com/ubuntu/ intrepid-updates main restricted
universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu/ intrepid-updates main
restricted universe multiverse

6. Save and close the file and update your APT sources again:

sudo apt-get update

Note: These last two steps are important!

>> versions not dangerous (package dependencies etc.)? How do I avoid

I haven't got into any trouble doing it this way and I consider it safe,
however, I take no responsibility if it breaks anything on your system.

Johannes

---

From: Timm Höhr <[email-masked]>
Date: Wed, 14 Jan 2009 22:41:56 +0100

>> just download ParaView from www.paraview.org. It's distributed as a

Hi Garth and Johannes,

I tried the ParaView binary and it worked. Thanks.
I was able to load the vtk-file that was produced by running the FEniCS 
demo script.
But I did not find out how to plot something different than a flat 
surface where u(x,y) only determines the color. I would have liked 
u(x,y) to define the height z of the graph, to get a topographic 
impression of the solution. But that is maybe a ParaView question and 
does not belong here, unless you happen to know.

By the way, I used the old demo.py that is presented in the FEniCS 
tutorial. The current one results in the following error (thereby 
getting back to - well, closer to - the original thread topic):

# python demo.py
Traceback (most recent call last):
   File "demo.py", line 5, in <module>
     V = FunctionSpace(mesh, "CG", 1)
NameError: name 'FunctionSpace' is not defined

Timm

---

From: Anders Logg <[email-masked]>
Date: Thu, 15 Jan 2009 08:18:20 +0100

> does not belong here, unless you happen to know.

Try the filter named "warp scalar".

> NameError: name 'FunctionSpace' is not defined

Looks like you have an old version of DOLFIN installed.

-- 
Anders

---

From: Timm Höhr <[email-masked]>
Date: Thu, 15 Jan 2009 23:52:59 +0100

I just installed it a few days ago but, yes, there was a more recent 
FEniCS available. After updating, the newer example works, the old one 
not anymore, so it makes sense.

But - new or old example - still I did not succeed to plot it in 
paraview as a surface plot. I want it displayed in a similar way as what 
is popping up after running the demo script.
'warp scalar' did not help. I wonder whats wrong, it should be a common 
way to plot.

Let me know, if this discussion should take place elsewhere.

Regards,
Timm