Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)?

like image 507
Ham82 Avatar asked Jul 08 '19 13:07

Ham82


2 Answers

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

like image 126
amalik2205 Avatar answered Nov 12 '22 22:11

amalik2205


tensorflow-probability 0.7.0 is not compatible with: tensorflow 1.13.1 check the tensoflow-probability version release page https://github.com/tensorflow/probability/releases

Correct solution will be either to upgrade tensorflow to 1.14.0 or downgrade tensorflow-probability to 0.6.0

pip install -U tensorflow-probability==0.6.0
like image 5
Neeraj Jain Avatar answered Nov 12 '22 23:11

Neeraj Jain