joblib fails at import on Python3.8

Created on 25 Jul 2019  路  4Comments  路  Source: joblib/joblib

>>> import joblib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pierreglaser/.virtualenvs/py38/lib/python3.8/site-packages/joblib/__init__.py", line 119, in <module>
    from .parallel import Parallel
  File "/home/pierreglaser/.virtualenvs/py38/lib/python3.8/site-packages/joblib/parallel.py", line 28, in <module>
    from ._parallel_backends import (FallbackToBackend, MultiprocessingBackend,
  File "/home/pierreglaser/.virtualenvs/py38/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 22, in <module>
    from .executor import get_memmapping_executor
  File "/home/pierreglaser/.virtualenvs/py38/lib/python3.8/site-packages/joblib/executor.py", line 14, in <module>
    from .externals.loky.reusable_executor import get_reusable_executor
  File "/home/pierreglaser/.virtualenvs/py38/lib/python3.8/site-packages/joblib/externals/loky/__init__.py", line 12, in <module>
    from .backend.reduction import set_loky_pickler
  File "/home/pierreglaser/.virtualenvs/py38/lib/python3.8/site-packages/joblib/externals/loky/backend/reduction.py", line 125, in <module>
    from joblib.externals import cloudpickle  # noqa: F401
  File "/home/pierreglaser/.virtualenvs/py38/lib/python3.8/site-packages/joblib/externals/cloudpickle/__init__.py", line 3, in <module>
    from .cloudpickle import *
  File "/home/pierreglaser/.virtualenvs/py38/lib/python3.8/site-packages/joblib/externals/cloudpickle/cloudpickle.py", line 152, in <module>
    _cell_set_template_code = _make_cell_set_template_code()
  File "/home/pierreglaser/.virtualenvs/py38/lib/python3.8/site-packages/joblib/externals/cloudpickle/cloudpickle.py", line 133, in _make_cell_set_template_code
    return types.CodeType(
TypeError: an integer is required (got type bytes)

The last joblib pypi releases only has cloudpickle0.8 which is not compatible with python3.8. We should release a new joblib soon.

Other errors due to old cloudpickle: #909

Most helpful comment

scikit-learn 0.20 embeds an old joblib version and neither support Python 3.8. Use scikit-learn 0.22 and joblib 0.14 or later for Python 3.8 support.

All 4 comments

Is this issue fixed with PR https://github.com/joblib/joblib/pull/936?

In my case I installed scikit-learn==0.20 with Python 3.8 and imported a toy dataset:

_________________________________________ ERROR collecting tests/EstimatorTest.py _________________________________________
tests/EstimatorTest.py:16: in <module>
    from sklearn.datasets import load_iris
/usr/local/miniconda3/envs/porter_38_022/lib/python3.8/site-packages/sklearn/__init__.py:64: in <module>
    from .base import clone
/usr/local/miniconda3/envs/porter_38_022/lib/python3.8/site-packages/sklearn/base.py:13: in <module>
    from .utils.fixes import signature
/usr/local/miniconda3/envs/porter_38_022/lib/python3.8/site-packages/sklearn/utils/__init__.py:13: in <module>
    from .validation import (as_float_array,
/usr/local/miniconda3/envs/porter_38_022/lib/python3.8/site-packages/sklearn/utils/validation.py:27: in <module>
    from ..utils._joblib import Memory
/usr/local/miniconda3/envs/porter_38_022/lib/python3.8/site-packages/sklearn/utils/_joblib.py:18: in <module>
    from ..externals.joblib import __all__   # noqa
/usr/local/miniconda3/envs/porter_38_022/lib/python3.8/site-packages/sklearn/externals/joblib/__init__.py:119: in <module>
    from .parallel import Parallel
/usr/local/miniconda3/envs/porter_38_022/lib/python3.8/site-packages/sklearn/externals/joblib/parallel.py:32: in <module>
    from .externals.cloudpickle import dumps, loads
/usr/local/miniconda3/envs/porter_38_022/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/__init__.py:3: in <module>
    from .cloudpickle import *
/usr/local/miniconda3/envs/porter_38_022/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py:151: in <module>
    _cell_set_template_code = _make_cell_set_template_code()
/usr/local/miniconda3/envs/porter_38_022/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py:132: in _make_cell_set_template_code
    return types.CodeType(
E   TypeError: an integer is required (got type bytes)

Maybe that helps.

scikit-learn 0.20 embeds an old joblib version and neither support Python 3.8. Use scikit-learn 0.22 and joblib 0.14 or later for Python 3.8 support.

scikit-learn 0.20 embeds an old joblib version and neither support Python 3.8. Use scikit-learn 0.22 and joblib 0.14 or later for Python 3.8 support.

You just saved me a day full of headaches, thank you!

@ogrisel thanks for the tip!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

twiecki picture twiecki  路  7Comments

aseyboldt picture aseyboldt  路  3Comments

rizplate picture rizplate  路  3Comments

mhooreman picture mhooreman  路  3Comments

rth picture rth  路  10Comments