profile
viewpoint

Ask questions ModuleNotFoundError: No module named 'tensorflow.compat.v2'

Was going through the Jupyter notebook on TFP that was associated with the TF Dev Summit:

https://github.com/tensorflow/probability/blob/master/tensorflow_probability/examples/jupyter_notebooks/Probabilistic_Layers_Regression.ipynb Run

Running the line

import tensorflow.compat.v2 as tf

Returns the error:

ModuleNotFoundError: No module named 'tensorflow.compat.v2'

Running tf.VERSION shows it's 1.13.

I'm assuming this is related to not having TF 2.0 installed, and only having T 1.13 installed. Is a separate, 2nd installation of TF (2.0) needed to import tensorflow.compat.v2 or can both be installed into the same virtual environment?

Just want to make sure installing both alongside each other won't break either or both.

You can collect some of this information using our environment capture script You can also obtain the TensorFlow version with python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"

b'unknown' 1.13.1

tensorflow/tensorflow

Answer questions joyalbin

@cpoptic just want to add my observation here, in my understanding tensorflow-probability is not installed along with tensorflow. Could please try with your test script after installing pip install --user --upgrade tensorflow-probability Hope this will help you

useful!
source:https://uonfu.com/
Github User Rank List