PETSc error code is: 76 while computing Gradient

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.