This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

import both vtk and dolfin

0 votes

Dear all:

Getting some troubles importing both vtk and dolfin in a single script…

I can run python -c "import vtk; image = vtk.vtkImageData()" without any
issue, but python -c "import vtk; import dolfin; image = vtk.vtkImageData()" gives me a seg fault.

With a slightly more complex example, I'm getting some more info:

[0]PETSC ERROR:

[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation,
probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or
-on_error_attach_debugger
[0]PETSC ERROR: or see
http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind[0]PETSC
ERROR: or try http://valgrind.orgon GNU/linux and Apple Mac OS X to
find memory corruption errors
[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link,
and run

[0]PETSC ERROR: to get more information on the crash.

MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 59.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on

exactly when Open MPI kills them.

Any idea what might be going on? Anybody has been able to load both vtk
and dolfin?

Thanks!

Martin

asked Feb 16, 2016 by Martin Genet FEniCS User (1,460 points)

I just tried running you MWE

python -c "import vtk; import dolfin; image = vtk.vtkImageData()"

in my terminal and it works just fine. Are you able to import dolfin independently, e.g. running

python -c "import dolfin;"

How did you install FEniCS?

Thanks! Yes, python -c "import dolfin" works just fine. I installed FEniCS using the ppa, but I had to use a trick since I'm using vtk6 (see http://fenicsproject.org/qa/9159/install-from-ppa-on-vtk6-system). Maybe that's the issue. How did you install FEniCS? And VTK? Thanks again.

1 Answer

+1 vote
 
Best answer

I think your problem is related to your customized FEniCS installation. I would recommend using a standard installation with vtk5 or, as suggested by johannr, build from source with vtk6.

answered Feb 16, 2016 by emher FEniCS User (1,290 points)
selected Feb 17, 2016 by Martin Genet

Thanks! Any idea what would be the procedure to build DOLFIN alongside VTK6? Thanks again.

For the record, according to Johannes, in order to use the system's vtk, it's as easy as writing

vtk:
    use: host-vtk

in the hashdist profile.

...