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

Lawrence Mitchell lawrence.mitchell at imperial.ac.uk
Tue Jul 14 03:37:45 CDT 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Justin,

On 14/07/15 09:24, Justin Chang wrote:
> 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
> <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 32, 
> in <module> _common = swig_import_helper() File
> "/usr/lib/python2.7/dist-packages/dolfin/cpp/common.py", line 28, 
> in swig_import_helper _mod = imp.load_module('_common', fp,
> pathname, description) File
> "/usr/local/lib/python2.7/dist-packages/petsc4py/PETSc.py", line 4,
> in <module> PETSc._initialize() File "PETSc/PETSc.pyx", line 407,
> in petsc4py.PETSc._initialize (src/petsc4py.PETSc.c:232527) File
> "PETSc/PETSc.pyx", line 395, in petsc4py.PETSc.register 
> (src/petsc4py.PETSc.c:232364) File "PETSc/Object.pyx", line 257,
> in petsc4py.PETSc.PyPetscType_Register
> (src/petsc4py.PETSc.c:64906) 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
> git+https://bitbucket.org/mapdes/petsc4py.git@firedrake#egg=petsc4py
>
>  I tried uninstalling petsc4py via sudo pip uninstall but it says
> "Not uninstalling petsc4py at /usr/lib/pymodules/python2.7, owned
> by OS".

Something funky is going on here, since the petsc4py in the backtrace
above lives in /usr/local/lib/python2.7/... not
/usr/lib/pymodules/python2.7

I presume "pip list" doesn't list petsc4py anywhere.

 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?

This looks a bit like there are two petsc4py versions kicking around.
Does just importing petsc4py work at all (from petsc4py import PETSc),
and if so, where does it point to?  (print PETSc.__file__).

Do things work if you manually remove petsc4py from
/usr/local/lib/python2.7/dist-packages/petsc4py?

Cheers,

Lawrence
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJVpMpVAAoJECOc1kQ8PEYvE+QH/R8V9n7a/v18eREO4t06h/X1
jrYyU3AmYEQUaKHUnDyhS0G3ew4jVUWscSzxqqagnQFZLsegm2ubS5+q22tWn52k
W7ExtrZ1EQl2D2KcivJH0o1cQmmufoV3A3M+VjW4yKhoBWacDK4FabFwu7xWdx5S
RWUWbYHfsjjiTaVFneuFwNZUhwYs4Eofnx4OBRBhji704rUhcqLZhiJDBFJJrnCA
bcRMusvU6Bfq1+xtrmLYZnJqN45vUK4tnXdMQUBJCQi3jBwh+yMB2MLTX2qmoQzO
VvxRS4wC7Cl91tYC7rqh6GzVh5oZNocet+0OQ9+/AwdjDwVa7ppSplMnJAWeQrc=
=Ksbp
-----END PGP SIGNATURE-----


More information about the petsc-users mailing list