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

Cannot import fenics and vtk together

+1 vote

Hi,

For some reason, I don't seems to be able to import fenics and vtk together.
If I run a script in command line with

import fenics
import vtk

it won't work, whereas removing either line works.

closed with the note: Forum is for posing questions. If you believe this could be a bug, email fenics-support@fenicsproject.org.
asked Aug 12, 2014 by lee FEniCS User (1,170 points)
closed Aug 13, 2014 by Garth N. Wells

This works fine for me. Please give more information like any error messages, your platform, how you installed FEniCS, etc.

For me it works fine as well. Ubuntu 14.04, dolfin 1.3.0 built from source via dorsal

I am running fenics on Ubuntu 14.04 and I installed fenics using
sudo apt-get install fenics

It seems to be some error due to PetSc:

If I run the following code:

import fenics
import vtk
reader = vtk.vtkXMLUnstructuredGridReader()
reader.SetFileName('output000000.vtu')
reader.Update()
print reader.GetOutput()

I got the error:
[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.org on 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.

and if I reverse the order of the first 2 line i.e. import vtk then import fenics, I got the following error:

Fatal error in PMPI_Comm_set_errhandler: Invalid communicator, error stack:
PMPI_Comm_set_errhandler(140): MPI_Comm_set_errhandler(comm=0x7ad95ec0, errh=0x7ad96be0) failed
PMPI_Comm_set_errhandler(95).: Invalid communicator
Command terminated

Any help would be greatly appreciated!

Thanks a lot!!!

...