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

python crashes when importing fenics: "ImportError: No module named PETSc", although petsc is installed

0 votes

error message below:

  File "main.py", line 16, in <module>
    from fenics import *
  File "/usr/lib/python2.7/dist-packages/fenics/__init__.py", line 6, in <module>
    from dolfin import *
  File "/usr/lib/python2.7/dist-packages/dolfin/__init__.py", line 16, in <module>
    from . import cpp
  File "/usr/lib/python2.7/dist-packages/dolfin/cpp/__init__.py", line 42, in <module>
    exec("from . import %s" % module_name)
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/dolfin/cpp/common.py", line 30, in <module>
    _common = swig_import_helper()
  File "/usr/lib/python2.7/dist-packages/dolfin/cpp/common.py", line 26, in swig_import_helper
    _mod = imp.load_module('_common', fp, pathname, description)
  File "/usr/lib/pymodules/python2.7/petsc4py/PETSc.py", line 3, in <module>
    PETSc = ImportPETSc(ARCH)
  File "/usr/lib/pymodules/python2.7/petsc4py/lib/__init__.py", line 29, in ImportPETSc
    return Import('petsc4py', 'PETSc', path, arch)
  File "/usr/lib/pymodules/python2.7/petsc4py/lib/__init__.py", line 63, in Import
    fo, fn, stuff = imp.find_module(name, pathlist)
ImportError: No module named PETSc

many thanks.

closed with the note: Please use the fenics-support mailing list for these types of questions, see http://fenicsproject.org/support/
asked Sep 26, 2016 by martinpauthenet FEniCS Novice (220 points)
closed Sep 27, 2016 by johannr
...