joblib.externals.cloudpickle removed in joblib 1.6.0
In our sandbox runs up to 2026-10-27, gemini-3.8-flash and gpt-6.1-sol wrote from joblib.externals import cloudpickle for joblib. It fails on 1.6.0 with ImportError (changed between 1.5.3 and 1.6.0). Use import cloudpickle instead.
- What to do
- replace the line
- Output
- same on one example
- Patch
- applies word for word
- Auto-apply
- allowed
- Seen in
- 2 models
- Worked / failed
- 3 / 0
- Last verified
- 2026-10-27
What to do
Replace the old line with the new one; the rest of the code can stay.
Automatic application: allowed — proof.equivalent is true and the patch applies word for word. Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own. The change itself is described by kind (removed); the checks are in proof; neither follows from the other.
How to tell this applies to your code
- joblib version 1.6.0 or newer is installed (checked on 1.6.0; changed between 1.5.3 and 1.6.0).
- Your code uses:
cloudpickle - Or it already failed with:
ImportError: cannot import name 'cloudpickle' from 'joblib.externals' (/usr/local/lib/python3.11/site-packages/joblib/externals/__ini(every correction for this error)
Old and new code
from joblib.externals import cloudpickleimport cloudpickle
Error on 1.6.0:
ImportError: cannot import name 'cloudpickle' from 'joblib.externals' (/usr/local/lib/python3.11/site-packages/joblib/externals/__init__.py)
| Script | joblib version | Result |
|---|---|---|
| Code the models wrote | 1.5.3 | works |
| Code the models wrote | 1.6.0 | fails: ImportError |
| Verified example below | 1.6.0 | works |
| Output of the verified example | 1.6.0 | same as the original's on 1.5.3 (observed stdout of one example; not a proof of equivalent behaviour) |
| Patch applied word for word to the example | 1.6.0 | applied word for word, the patch parses, runs and prints what the verified example prints |
Verified example for joblib 1.6.0
import pickle
import cloudpickle
def main():
# 1. Define a lambda and a locally defined closure
f_lambda = lambda x, y: x**2 + y
def make_closure(multiplier, offset):
def inner(val):
return val * multiplier + offset
return inner
f_closure = make_closure(multiplier=10, offset=7)
# 2. Serialize both to bytes using joblib's bundled cloudpickle
lambda_bytes = cloudpickle.dumps(f_lambda)
closure_bytes = cloudpickle.dumps(f_closure)
# 3. Load them back using the standard library's pickle module
restored_lambda = pickle.loads(lambda_bytes)
restored_closure = pickle.loads(closure_bytes)
# 4. Print results of calling each restored function on sample inputs
print("Testing restored lambda:")
print("restored_lambda(3, 5):", restored_lambda(3, 5))
print("restored_lambda(4, -2):", restored_lambda(4, -2))
print("\nTesting restored closure:")
print("restored_closure(2):", restored_closure(2))
print("restored_closure(5):", restored_closure(5))
if __name__ == "__main__":
main()Source
Unvendor cloudpickle to more quickly benefit from maintenance releases of cloudpickle
Release notes · Seen in: gemini-3.8-flash, gpt-6.1-sol · First seen 2026-10-26 · Last verified 2026-10-27 · All corrections for joblib
For agents
- This page as JSON:
https://formachines.ai/errata/pypi/joblib/0002-joblib-externals-cloudpickle/index.json - Whole database in plain text:
/errata/llms-full.txt - Install the skill:
npx skills add formachines-ai/skills@model-errata(source on GitHub) - Confirm, dispute or add a correction: feedback form and API
- Apply a correction on your own only when its
proof.auto_applyis true (Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own.)