PETSc error code is: 76 while computing Gradient

Hi, I am trying to generate a gradient for the electric potential generated from a mesh. The electric potentials are stored in phi_values. I am trying to find the gradient using

E_space = VectorFunctionSpace(self.geometry.mesh, ‘DG’, 1)
E_field = project(-grad(phi_values), E_space)
return E_field
but I get the following error
line 138, in project, function.vector(), b, solver_type, preconditioner_type)

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at


*** Remember to include the error message listed below and, if possible,
*** include a minimal running example to reproduce the error.

*** -------------------------------------------------------------------------
*** Error: Unable to successfully call PETSc function ‘KSPSolve’.
*** Reason: PETSc error code is: 76 (Error in external library).
*** Where: This error was encountered inside /home/conda/feedstock_root/build_artifacts/fenics_1555852928859/work/dolfin/la/PETScKrylovSolver.cpp.
*** Process: 0

*** DOLFIN version: 2018.1.0
*** Git changeset: 9e1777c0df7c762c7230189c87c13fd5ad33a4f0
*** -------------------------------------------------------------------------

how can I solve this ?

You would have to provide a minimal running example, as also stated in

Please note that several others have also asked similar questions: Search results for '*** Reason: PETSc error code is: 76 (Error in external library)' - FEniCS Project.