You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [1]: import tensorflow_probability
In [2]: import tensorflow
succeeds, and I can use tf and tf keras and import and use my own modules which use them . But
In [1]: import tensorflow
In [2]: import tensorflow_probability
returns the (familiar) error
File ~/miniforge3/envs/tensorflow/lib/python3.13/site-packages/tensorflow_probability/python/__init__.py:79, in _validate_tf_environment(package)
77 if required_tensorflow_version[0] == '2':
78 try:
---> 79 import tf_keras # pylint: disable=unused-import
80 except (ImportError, ModuleNotFoundError):
81 # Print more informative error message, then reraise.
82 print('\n\nFailed to import TF-Keras. Please note that TF-Keras is not '
83 'installed by default when you install TensorFlow Probability. '
84 'This is so that JAX-only users do not have to install TensorFlow '
(...) 87 'This can be be done through installing the '
88 'tensorflow-probability[tf] extra.\n\n')
ModuleNotFoundError: No module named 'tf_keras'
When importing tf and tfp at the top of my own modules, this error also appears when I import mymodule no matter what order the import of tf and tfp happens in the module file.
I am note even sure how to debug this! I guess something to do with namespaces getting messed up, but I am very much a user not a dev...
Activity
csuter commentedon Aug 22, 2025
Please confirm that you've followed the recommendations in the release notes for keras compatibility, and let us know if that doesn't fix it.