We carry out the programme of R. Liouville [19] to construct an explicit local obstruction to the existence of a Levi–Civita connection
within a given projective structure [..] on a surface. The obstruction is of order 5 in the components of a connection in a
projective class. It can be expressed as a point invariant for a second order ODE whose integral curves are the geodesics of [..] or as a weighted scalar projective invariant of the projective class. If the obstruction vanishes we find the sufficient conditions for the existence of a metric in the real analytic case. In the generic case they are expressed by the vanishing of two invariants of order 6 in the connection. In degenerate cases the sufficient obstruction is of order at most 8.