Search code examples
pythontensorflowtensorflow-probability

No module named 'tensorflow_probability'


I need to use Tensorflow and Tensorflow_Probability. After installing it by these commands: conda install tensorflow-probability or pip install --upgrade tensorflow-probability , I ran it in the notebook:

import tensorflow_probability as tfp

but it returns this error:

    ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-8-41494c8c96ff> in <module>
----> 1 import tensorflow_probability as tfp

ModuleNotFoundError: No module named 'tensorflow_probability'.

The results of

pip list

is as below (related parts):

tblib                              1.3.2
tensorboard                        1.13.1
tensorflow                         1.13.1
tensorflow-estimator               1.13.0
tensorflow-probability             0.7.0
termcolor                          1.1.0
terminado                          0.8.1
testpath                           0.4.2
tfp-nightly                        0.8.0.dev20190708
Theano                             1.0.4
toolz                              0.9.0

Can anyone help me to solve this problem (I am using Win 10)?


Solution

  • Your versions are correct and your command is correct too.

    Seems like inconsistency in other module is causing this.

    run the following commands and try again:

    pip install -U dm-sonnet==1.23
    pip install --upgrade tfp-nightly
    

    References: https://github.com/deepmind/graph_nets/issues/3 https://github.com/tensorflow/probability/issues/103