I am assuming that you are using legacy FEniCS.
Then you need to install a compatible version of ufl, see: