question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

joblib fails at import on Python3.8

See original GitHub issue
>>> 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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

41reactions
ogriselcommented, Dec 19, 2019

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.

0reactions
Carlos1729commented, Jun 17, 2021

I still face Issues with all the requirements satisfied.

Traceback (most recent call last): File “/anaconda3/lib/python3.8/site-packages/django/core/handlers/exception.py”, line 47, in inner response = get_response(request) File “/anaconda3/lib/python3.8/site-packages/django/core/handlers/base.py”, line 181, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File “/anaconda3/lib/python3.8/site-packages/django/contrib/auth/decorators.py”, line 21, in _wrapped_view return view_func(request, *args, **kwargs) File “/Projectfolder/predict_risk/views.py”, line 31, in PredictRisk standard_scalar = GetStandardScalarForHeart() File “/Projectfolder/predict_risk/data_provider.py”, line 32, in GetStandardScalarForHeart return GetPickleFile(config[‘heart’][‘scalar_file’]) File “/projectfolder/predict_risk/data_provider.py”, line 27, in GetPickleFile return pickle.load(open(os.path.join(dir, filepath), “rb”)) File “/anaconda3/lib/python3.8/site-packages/sklearn/init.py”, line 65, in <module> from .utils._show_versions import show_versions File “/anaconda3/lib/python3.8/site-packages/sklearn/utils/init.py”, line 13, in <module> from .validation import (as_float_array, File “/anaconda3/lib/python3.8/site-packages/sklearn/utils/validation.py”, line 27, in <module> from …utils._joblib import Memory File “/anaconda3/lib/python3.8/site-packages/sklearn/utils/_joblib.py”, line 18, in <module> from …externals.joblib import all # noqa File “/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/init.py”, line 119, in <module> from .parallel import Parallel File “/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/parallel.py”, line 32, in <module> from .externals.cloudpickle import dumps, loads File “/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/init.py”, line 3, in <module> from .cloudpickle import * File “/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py”, line 150, in <module> _cell_set_template_code = _make_cell_set_template_code() File “/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py”, line 131, in _make_cell_set_template_code return types.CodeType( TypeError: an integer is required (got type bytes)

@ogrisel

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: cannot import name 'joblib' from 'sklearn.externals'
When getting error: from sklearn.externals import joblib it deprecated older version. For new version follow:.
Read more >
joblib.Parallel — joblib 1.3.0.dev0 documentation
Ability to use shared memory efficiently with worker processes for large numpy-based datastructures. Examples. A simple example: >>> from math import sqrt ...
Read more >
Importerror: cannot import name joblib from sklearn.externals
Importerror: cannot import name joblib from sklearn.externals error occurs due to deprecation of sklearn.externals.joblib in version 0.21.
Read more >
multiprocessing — Process-based parallelism — Python 3.11 ...
The following example demonstrates the common practice of defining such functions in a module so that child processes can successfully import that module....
Read more >
Resolve "Unable to import module" errors from Python ... - AWS
How do I resolve the "Unable to import module" error that I receive when I run ... sudo amazon-linux-extras install python3.8 $ curl...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found