diff --git a/python/ray/__init__.py b/python/ray/__init__.py index c631fb069..10918f0d0 100644 --- a/python/ray/__init__.py +++ b/python/ray/__init__.py @@ -11,12 +11,19 @@ logger = logging.getLogger(__name__) if "pickle5" in sys.modules: import pkg_resources - version_info = pkg_resources.require("pickle5") - version = tuple(int(n) for n in version_info[0].version.split(".")) - if version < (0, 0, 10): - raise ImportError("You are using an old version of pickle5 that " - "leaks memory, please run 'pip install pickle5 -U' " - "to upgrade") + try: + version_info = pkg_resources.require("pickle5") + version = tuple(int(n) for n in version_info[0].version.split(".")) + if version < (0, 0, 10): + raise ImportError("You are using an old version of pickle5 " + "that leaks memory, please run " + "'pip install pickle5 -U' to upgrade") + except pkg_resources.DistributionNotFound: + logger.warning("You are using the 'pickle5' module, but " + "the exact version is unknown (possibly carried as " + "an internal component by another module). Please " + "make sure you are using pickle5 >= 0.0.10 because " + "previous versions may leak memory.") if "OMP_NUM_THREADS" not in os.environ: logger.debug("[ray] Forcing OMP_NUM_THREADS=1 to avoid performance "