saving a model I get module 'tensorflow.python.saved_model.registration' has no attribute 'get_registered_name'
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
The error module 'tensorflow.python.saved_model.registration' has no attribute 'get_registered_name' occurs due to a version mismatch between TensorFlow and Keras (or other TensorFlow-dependent libraries like tensorflow-hub or keras-nlp). This internal function was introduced or moved in specific TensorFlow versions, and mixing incompatible versions causes the attribute lookup to fail. The fix is to ensure TensorFlow, Keras, and all TF-related packages are on compatible versions — typically by upgrading everything to the latest stable release or pinning exact compatible versions.
When This Error Occurs
This can also happen during tf.saved_model.save(), model.save(), or when loading a saved model with tf.keras.models.load_model().
Fix 1: Upgrade TensorFlow and Keras
TensorFlow 2.x bundles Keras internally (tf.keras). If you also have a standalone keras package installed, version conflicts arise.
Fix 2: Pin Compatible Versions
Check version compatibility:
Fix 3: Use a Virtual Environment
Fix 4: Clean Reinstall
When version conflicts persist:
Fix 5: Use tf.keras Consistently
Alternative Save Formats
If the error persists during saving, try alternative formats:
Diagnosing the Issue
Common Pitfalls
- Mixing
kerasandtf.kerasimports: TensorFlow 2.x bundles its own Keras astf.keras. Installing the standalonekeraspackage alongside TensorFlow creates two competing Keras installations with different internal registrations. Usetf.kerasexclusively, or uninstall the standalonekeraspackage. - Upgrading TensorFlow without upgrading dependent packages: Libraries like
tensorflow-hub,tensorflow-text,keras-nlp, andtensorflow-addonsdepend on specific TensorFlow internals. Upgrading TensorFlow alone while keeping old versions of these libraries causes attribute errors. Upgrade all TF-related packages together. - Using
pip install tensorflow-gpuon TF 2.x: Since TensorFlow 2.1+, GPU support is included in the basetensorflowpackage. Installingtensorflow-gpuseparately can pull in a different TensorFlow version, creating conflicts. Usepip install tensorflowonly. - Conda and pip mixing: Installing TensorFlow with conda and other packages with pip (or vice versa) can cause conflicting dependency resolutions. Stick to one package manager. If using conda, install TensorFlow with
conda install tensorflow. - Not restarting the Python runtime after upgrading: After
pip install --upgrade tensorflow, existing Python processes still use the old version loaded in memory. Restart your Jupyter kernel, Python script, or IDE to pick up the new version.
Summary
- This error is caused by TensorFlow/Keras version mismatches — the internal
registrationmodule API changed between versions - Upgrade TensorFlow and all TF-related packages together:
pip install --upgrade tensorflow - Use
tf.kerasconsistently — never mix standalonekerasimports withtf.keras - Use a clean virtual environment to avoid dependency conflicts
- As a workaround, save in HDF5 format (
model.save('model.h5')) which bypasses the SavedModel registration system

