[petsc-users] A combined petsc4py, FEniCS, and Firedrake issue

Justin Chang jychang48 at gmail.com
Tue Jul 14 03:24:09 CDT 2015

Hi everyone,

As the title says, I have an issue regarding all three. Not sure which
mailing to post this to but i figured somebody here may help.

I was attempting to install Firedrake on my Ubuntu PC, so far it has not
worked yet. However, after my failed attempt, i tried to run some of my old
FEniCS programs, and something within the Dolfin library has screwed up.
Below is the error:

Traceback (most recent call last):
  File "Idealized_reservoir.py", line 8, in <module>
    from dolfin import *
  File "/usr/lib/python2.7/dist-packages/dolfin/__init__.py", line 16, in
    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 32, in
    _common = swig_import_helper()
  File "/usr/lib/python2.7/dist-packages/dolfin/cpp/common.py", line 28, in
    _mod = imp.load_module('_common', fp, pathname, description)
  File "/usr/local/lib/python2.7/dist-packages/petsc4py/PETSc.py", line 4,
in <module>
  File "PETSc/PETSc.pyx", line 407, in petsc4py.PETSc._initialize
  File "PETSc/PETSc.pyx", line 395, in petsc4py.PETSc.register
  File "PETSc/Object.pyx", line 257, in petsc4py.PETSc.PyPetscType_Register
ValueError: key: 0, cannot register: <type 'petsc4py.PETSc.Partitioner'>,
already registered: None

It seems I screwed something up when I attempted to installed petsc4py. The
following command was used to install petsc4py per firedrake instructions:

sudo pip install

I tried uninstalling petsc4py via sudo pip uninstall but it says "Not
uninstalling petsc4py at /usr/lib/pymodules/python2.7, owned by OS". I
reinstalled fenics/dolfin and all of its dependencies but i still get the
traceback errors above. I tried to upgrade petsc4py sudo pip install -U
--no-deps ... but it says "Can't roll back petsc4py; was not uninstalled".

Any idea what I can do here?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150714/238a2981/attachment-0001.html>

More information about the petsc-users mailing list