Unknown ufl object type VectorElement error

I received such an error. I deleted the files in this directory but the problem persists. (/home/yourname/.local)

Unknown ufl object type VectorElement
Traceback (most recent call last):
File “/home/runo/asdasdas/test2/test2.py”, line 22, in
V = VectorFunctionSpace(mesh, ‘Lagrange’, degree = 2)
File “/usr/lib/petsc/lib/python3/dist-packages/dolfin/function/functionspace.py”, line 245, in VectorFunctionSpace
return FunctionSpace(mesh, element, constrained_domain=constrained_domain)
File “/usr/lib/petsc/lib/python3/dist-packages/dolfin/function/functionspace.py”, line 31, in init
self._init_from_ufl(*args, **kwargs)
File “/usr/lib/petsc/lib/python3/dist-packages/dolfin/function/functionspace.py”, line 42, in _init_from_ufl
ufc_element, ufc_dofmap = ffc_jit(element, form_compiler_parameters=None,
File “/usr/lib/petsc/lib/python3/dist-packages/dolfin/jit/jit.py”, line 50, in mpi_jit
return local_jit(*args, **kwargs)
File “/usr/lib/petsc/lib/python3/dist-packages/dolfin/jit/jit.py”, line 100, in ffc_jit
return ffc.jit(ufl_form, parameters=p)
File “/usr/local/lib/python3.10/dist-packages/ffc/jitcompiler.py”, line 214, in jit
kind, module_name = compute_jit_prefix(ufl_object, parameters)
File “/usr/local/lib/python3.10/dist-packages/ffc/jitcompiler.py”, line 156, in compute_jit_prefix
error(“Unknown ufl object type %s” % (ufl_object.class.name,))
File “”, line 1, in
File “/usr/local/lib/python3.10/dist-packages/ufl/log.py”, line 172, in error
raise self._exception_type(self._format_raw(*message))
Exception: Unknown ufl object type VectorElement

You have a mixture of system wide installation in /usr/lib/, and an installation that you obtained in some other way in /usr/local/lib.

Make a backup of /usr/local/lib/python3.10/dist-packages and the proceed with uninstalling ffc and ufl from there. After you have done that, they will be importing from /usr/lib/, not /usr/local/lib.

Once you are at it, look at Announcement: ufl_legacy and legacy dolfin just in case (summary: from now on you should import ufl_legacy, and not ufl, if you have any such import in your own code.)

1 Like