12756 import error for serializer missing yaml module

When the `pyyaml` package is not installed, raise an `ImportError` rather than saying the serializer does not exist.