Canonical Kahler metrics, such as Ricci-flat or Käahler–Einstein, are obtained via solving the complex Monge-Ampère equation. The famous Calabi–Yau theorem asserts the existence and regularity of solutions to this equation on compact Käahler manifolds for smooth data. In this note we shall present methods, based on pluripotential theory, which yield the results on the existence and stability of the weak solutions of the Monge–Ampère equation for possibly degenerate, non-smooth right hand side. Those weak solutions have also interesting applications in geometry. They lead to canonical metrics with singularities, which may occur as the limits of the Kähler–Ricci flow or the limits of families of Calabi–Yau metrics when the Kähler class hits the boundary of the Kähler cone.