diff --git a/dev-requirements.txt b/dev-requirements.txt index a367f706e76..a3f1507fc69 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -11,3 +11,4 @@ pytest >= 3.2 prometheus_client >= 0.6.0 jupyter-server-proxy >= 1.1.0 pytest-asyncio +pickle5; python_version >= '3.6' and python_version < '3.8' diff --git a/distributed/protocol/pickle.py b/distributed/protocol/pickle.py index 629fb962fbf..50612782d4b 100644 --- a/distributed/protocol/pickle.py +++ b/distributed/protocol/pickle.py @@ -3,8 +3,11 @@ import cloudpickle -if sys.version_info.major == 2: - import cPickle as pickle +if sys.version_info.major == 3 and sys.version_info.minor < 8: + try: + import pickle5 as pickle + except ImportError: + import pickle else: import pickle