ray.rllib.utils.checkpoints.try_import_msgpack#

ray.rllib.utils.checkpoints.try_import_msgpack(error: bool = False)[source]#

Tries importing msgpack and msgpack_numpy and returns the patched msgpack module.

Returns None if error is False and msgpack or msgpack_numpy is not installed. Raises an error, if error is True and the modules could not be imported.

Parameters:

error – Whether to raise an error if msgpack/msgpack_numpy cannot be imported.

Returns:

The msgpack module.

Raises:

ImportError – If error=True and msgpack/msgpack_numpy is not installed.