  We prove that if a Calabi--Yau manifold $M$ admits a holomorphic Cartan
geometry, then $M$ is covered by a complex torus. This is done by establishing
the Bogomolov inequality for semistable sheaves on compact K\"ahler manifolds.
We also classify all holomorphic Cartan geometries on rationally connected
complex projective manifolds.
