AttributeError module 'tensorflow.python.training.checkpointable' has no attribute 'CheckpointableBase'
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
The error AttributeError: module 'tensorflow.python.training.checkpointable' has no attribute 'CheckpointableBase' occurs because CheckpointableBase was renamed to Trackable in TensorFlow 2.x. Code written for TF 1.x (or libraries depending on TF 1.x internals) references the old internal API path. The fix is to upgrade TensorFlow and the library that triggered the error, or pin compatible versions if you must stay on TF 1.x.
The Error
This typically appears when:
- You upgraded TensorFlow but a dependent library still uses old internal APIs
- You are running code written for TF 1.x on TF 2.x
- A third-party library (keras-contrib, tensorflow-addons old versions, etc.) references removed internals
What Changed
TensorFlow reorganized its internal checkpoint/tracking API across versions:
| TF Version | API Path | Class Name |
| TF 1.x (early) | tf.python.training.checkpointable | CheckpointableBase |
| TF 1.15 | tf.python.training.tracking | TrackableBase |
| TF 2.x | tf.python.training.tracking | AutoTrackable |
Fix 1: Upgrade Everything (Recommended)
Most libraries have updated to use TF 2.x APIs. Upgrading resolves the issue.
Fix 2: Pin Compatible Versions
If you must use older code:
Fix 3: Monkey-Patch (Temporary Workaround)
This is a temporary fix — update the actual code or library as soon as possible.
Fix 4: Update the Import in Your Code
If the error is in your own code:
In most cases, you should use tf.keras.layers.Layer or tf.Module instead of internal tracking classes.
Fix 5: Use tf.compat.v1 for Migration
tf.compat.v1 does not restore all internal API paths. It primarily restores the public API (sessions, placeholders, etc.).
Identifying the Source
This helps identify which package needs upgrading.
Common Packages That Cause This
| Package | Fix |
keras-contrib | Upgrade or switch to tensorflow-addons |
tf-slim | pip install tf-slim>=1.1.0 |
tensorflow-addons | pip install tensorflow-addons>=0.15.0 |
tensorflow-hub | pip install tensorflow-hub>=0.12.0 |
| Custom code | Update imports to use tf.Module or tf.keras.layers.Layer |
Version Checking
Common Pitfalls
- Mixing TF 1.x and 2.x packages: Installing
tensorflow==2.xwith a library built fortensorflow==1.xcauses this error. Check compatibility matrices for all ML packages. - Using internal APIs:
tensorflow.python.*paths are internal and not guaranteed to be stable. Use public APIs (tf.keras,tf.Module,tf.saved_model) which have stability guarantees. - Virtual environment confusion: You may have TF 2.x installed globally but TF 1.x in a virtualenv (or vice versa). Check
pip list | grep tensorflowin the active environment. - Cached .pyc files: Old compiled Python files may reference the removed module. Delete
__pycache__directories and.pycfiles after upgrading. - Docker/container images: Pre-built Docker images (e.g.,
tensorflow/tensorflow:1.x) have old TF versions. Update your Dockerfile to usetensorflow/tensorflow:latestor a specific 2.x tag.
Summary
CheckpointableBasewas renamed toTrackablein TensorFlow 2.x- The error occurs when old code or libraries reference
tensorflow.python.training.checkpointable - Fix by upgrading TensorFlow and all dependent ML libraries to compatible versions
- Use
tf.keras.layers.Layerortf.Moduleinstead of internal tracking classes - Avoid importing from
tensorflow.python.*paths — they are internal and change between versions - Use
grepto find which installed package makes the outdated import

